Setup Laravel project on cPanel - laravel

I'm trying to set up a laravel project as a subdomain on cpanel but I'm getting parsing issues, and an error.
These are the steps I've done so far
zip the project and upload it to this directory public_html/encuestas
unzip and move contents to the directory above
get ssh access with PuTTY and cd into the directory
do this command in PuTTY composer install --ignore-platform-reqs
I've also done it all through the PuTTY, cloned the repository from bitbucket with the same results.
After the command I get this feedback
vc#un.net [~/public_html/encuestas]# composer install --ignore-platform-reqs
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Parse error: syntax error, unexpected '?' in /home/vc/public_html/encuestas/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 500
And when I go to the subdomain encuestas.un.ac.cr this is the error I get
Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)
I'm not sure if this is relevant but I suspect the php versions are the problem, in cpanel I have set the php version of this domain to PHP 7.1 (ea-php71) and these errors still persist, however the PHP System Default is set as 5.6 (I don't know how to change it). This was the solution I found online for the parsing errors but this hasn't worked.
I'm completely lost as to what could be happening or how to fix it?
EDIT:
when doing composer update this is the result
vc#un.net [~/public_html/encuestas]# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^7.1.3 but your PHP version (5.6.40) does not satisfy that requirement.
Problem 2
- barryvdh/laravel-dompdf v0.8.5 requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
- barryvdh/laravel-dompdf 0.8.x-dev requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
- barryvdh/laravel-dompdf v0.8.5 requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
- Installation request for barryvdh/laravel-dompdf ^0.8.5 -> satisfiable by barryvdh/laravel-dompdf[0.8.x-dev, v0.8.5].

On that cPanel subdomain make sure to set the php version to at least 7.1.3 that can be done in cpanel itself in MultiPHP Manager
After that you will get a list of your subdomains, select it and from the top right choose a php version that works with that package at least(7.1.3) in your case, Click Apply.
If you don't have that php version installed on your server then contact the Admin to activate or install it.
If that didn't work, for the subdomain, try to set that PHP version to the root domain.
If you have access to WHM you can install a new PHP version through the easyApache panel.
Sometimes you have to restart Apache server in order for the new php to work.

Related

Phalcon - Composer install of Dev-Tools error: requested PHP extension -

composer install with file compose.json
{
"require-dev": {
"phalcon/devtools": "~3.4"
}
}
should install Phalcon Dev-Tools.
Actual Behavior
Instead, it breaks with error
Your requirements could not be resolved to an installable set of packages.
Problem 1
Installation request for phalcon/devtools ~3.4 -> satisfiable by phalcon/devtools[v3.4.0].
phalcon/devtools v3.4.0 requires ext-phalcon ~3.3 -> the requested PHP extension phalcon is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
/Applications/MAMP/bin/php/php7.2.1/conf/php.ini You can also run php --ini inside a terminal to see which files are used by PHP in CLI mode.
Details
MacOS 10.13.5,
MAMP 4, PHP 7.2.1
php_phalcon.so 3.4 is copied into the extension directory and inserted into php.ini from php-phalcon-mamp
proof:
php -m
phalcon
....
how to force update composer ignoring the dependencies?
I figured it out by running the below command.
composer update --ignore-platform-reqs
composer install --ignore-platform-reqs

Cannot install laravel oci8

the composer require yajra/laravel-oci8:^8 command is giving me the following error:
C:\Users\yƶ\PhpstormProjects\BRP>composer require yajra/laravel-oci8:^8
./composer.json has been updated
Running composer update yajra/laravel-oci8
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires yajra/laravel-oci8 8 -> satisfiable by yajra/laravel-oci8[v8.0.0].
- yajra/laravel-oci8 v8.0.0 requires ext-oci8 >=2.0.0 -> it is missing from your system. Install or enable PHP's oci8 extension.
To enable extensions, verify that they are enabled in your .ini files:
- C:\PHP74\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Windows 10
PHP 7.4.6
Laravel 8.26.1
PHP Storm 2020.2.3
I am not using XAMMP or WAMP
I hope someone can help me out. Thank you in advance.
You are missing the OCI8 PHP extension, So follow these steps:
From http://pecl.php.net/package/oci8 download exact version, for you must be php_oci8-2.2.0, unzip it and copy to PHP ext folder, for you its in "C:\php74\ext"
Un-Comment "extension=php_oci8_11g.dll" in php.ini and restart Apache or any other web server that you are using
Check php_info(), oci8 should be enabled.
Run composer require yajra/laravel-oci8:^8 command again.
download extensions with suitable php version in https://windows.php.net/downloads/pecl/releases/oci8/
extract and copy all the .dll files to /xampp/php/ext
download instant client oracle with suitable OS and PHP version in http://www.oracle.com/technetwork/topics/winsoft-085727.html
extract and copy all the dll files to /xampp/apache/bin/ and copy it to /xampp/php/
install https://github.com/yajra/laravel-oci8

Unable to download any pdf packages via composer for larvel 5.5

i am using laravel 5.5 with php 7.0 version, I want to generate a pdf, i tried to install many pdf packages, but unable to install because of php 7.0 version, it requires min 7.1 to install any packages, i tried to find packages for 7.0 verision, but failed.
can anyone help me how to install package for php 7.0 veriosn
Below is the error, that i am getting,
Your requirements could not be resolved to an installable set of packages.
Problem 1 - nwidart/laravel-modules 4.1.0 requires php >=7.1 -> your PHP version (7.0.33) does not satisfy that requirement.
There are only 2 solutions out of this, You either upgrade your PHP version to 7.1 or downgrade your package versions which uses PHP7.0
If you tell me what packages are you using,I could help you out find the packages. Let me know what your use case is exactly, or why your cant upgrade to PHP7.1
Also it is important to note that PHP7.0 includes security vulnerabilities fixed in PHP7.1, So consider upgrading your framework to at-least Laravel 5.8
Edit:
here is a package for pdp utilities in laravel 5.5 -> https://github.com/niklasravnsborg/laravel-pdf
For laravel5.5 you will have to manually link the packages as auto discovery will not work.
Edit 2:
here is the problem, When you use composer require barryvdh/laravel-dompdf the composer installs the latest package which is 0.8.4 (compatible with PHP7.1 and higher), What you need to do instead is add the package manually to the composer file and then bind the version 0.8.3 like this under the require object -> "barryvdh/laravel-dompdf": "0.8.3" and then run composer update/install in the terminal

Unable to configure Homestead per-project with Laravel 6 on PHP <7.1

I'm setting up a Laravel 6 project to use Homestead per-project, but running into a Catch-22 when cloning the repo on a machine without PHP 7.2 installed locally.
The issue is that Laravel 6 requires PHP 7.2 (I have 7.1 installed locally), which means composer update will not work locally:
This package requires php ^7.2 but your HHVM version does not satisfy that requirement.
which means I cannot vagrant up to get to the Homestead box (that includes PHP 7.2) without having run composer update:
Message: LoadError: cannot load such file -- /Users/.../.../vendor/laravel/homestead/scripts/homestead.rb
which means I cannot get anything working.
To get around this, I either have to a) upgrade my local machine to PHP 7.2 to be able to run composer update or b) install Homestead separately and run vagrant up from there, both of which bypass the benefit of a per-project set up.
Is there something I'm missing to get this configuration to work?

How do you specify PHP version for Composer so that it won't download the latest builds?

I have shared hosting with PHP 5.3.8 where I cannot run Composer.
Yesterday I have installed Composer to my own computer and then I have "build" Restler with it. It has downloaded Illuminate too. Then I've uploaded them to my shared hosting and it didn't work because apparently Illuminate requires minimum PHP 5.4.
So, is there any possibility to specify PHP version for Composer? Or I should have switched PHP 5.6 off, and then PHP 5.3.x on on my PC.
Looks like you are using Restler 3 RC5, RC6 already have those dependencies removed
Restler uses illuminate only when you use blade templates, so you can saf. You can run composer update with no dev option
composer update --no-dev
For more details see https://getcomposer.org/doc/03-cli.md#update
This will install only the packages needed for production environment. Then you can upload the files to server and all should be fine.

Resources