Today I came across a very weird situation I have never encountered before and couldn't really find a fix anywhere.
Whenever I type php artisan
in my console, it doesn't return anything. Tried cloning the repo (which works fine on other machines here) multiple times and did a fresh composer update
, composer install
and set-up for the laravel project.
Found multiple cases like this on SO, and after running find -L ./ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l | grep "Errors parsing".
I got this log:
PHP Fatal error: Cannot redeclare random_bytes() in ./vendor/paragonie/random_compat/lib/random_bytes_openssl.php on line 83 Errors parsing ./vendor/paragonie/random_compat/lib/random_bytes_openssl.php PHP Fatal error: Cannot redeclare random_bytes() in ./vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php on line 148 Errors parsing ./vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php xargs: php: exited with status 255; aborting xargs: php: exited with status 255; aborting PHP Fatal error: Cannot redeclare random_int() in ./vendor/paragonie/random_compat/lib/random_int.php on line 191 Errors parsing ./vendor/paragonie/random_compat/lib/random_int.php PHP Fatal error: Cannot redeclare random_bytes() in ./vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php on line 76 Errors parsing ./vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
Hopefully you guys can help me.
Thanks!
I assume your problem is the same as people who has linting problem in PHP 7 in this link: https://github.com/paragonie/random_compat/issues/115 .
It's strange because for me it's working fine, so I must assume you aren't on the latest Laravel version or your composer.json
file isn't correct, because all of your package dependencies that need paragonie/random_compat
will have to point to the latest paragonie/random_compat
package which is 2.0.4
.
Check all of your Laravel default packages version number on composer.json
, make sure it's requiring to the correct required version like this:
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
}
Note: For the future reader, I believe you won't have to change the Laravel version one if you don't want to upgrade, but I believe you do have to change all of the rest package version to make it work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With