I cloned new project from github which has following dependencies:
"require": {
"php": ">=5.6.4",
"backpack/base": "^0.7.16",
"backpack/crud": "^3.2",
"backpack/permissionmanager": "^2.1",
"barryvdh/laravel-cors": "^0.9.2",
"laravel/framework": "5.4.*",
"laravel/passport": "^2.0",
"laravel/tinker": "~1.0",
"league/fractal": "^0.16.0"
},
When I am running composer update or any other command, it shows the error as follows:
PHP Fatal error: Default value for parameters with a class type hint can only be NULL in /usr/share/php/Symfony/Component/Console/Application.php on line 85
Fatal error: Default value for parameters with a class type hint can only be NULL in /usr/share/php/Symfony/Component/Console/Application.php on line 85
I am currently using PHP 5.6. What could be the problem?
Your Composer Version is not working with php 5.6
To bring it to work, use it as composer.phar
See https://getcomposer.org/download/
Download Composer Latest: v2.0.9
To quickly install Composer in the current directory, run the following script in your terminal. To automate the installation, use the guide on installing Composer programmatically.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
I deleted the composer (which was installed when I was using PHP7) and installed it again. It is solved my problem.
Ubuntu 20.04, PHP5.6
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.