I have a very weird issue since yesterday.
Running composer install
on my production server causes this error... Keep in mind I do not get any error on my local server (Homestead VM).
Nothing to install or update
Writing lock file
Generating autoload files
Executing command (CWD): php artisan clear-compiled
Executing command (CWD): php artisan optimize
Generating optimized class loader
Compiling common classes
Script php artisan optimize handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
Exception trace:
() at phar:///home/site/public_html/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:177
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///home/site/public_html/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:91
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///home/site/public_html/composer.phar/src/Composer/Installer.php:342
Composer\Installer->run() at phar:///home/site/public_html/composer.phar/src/Composer/Command/InstallCommand.php:131
Composer\Command\InstallCommand->execute() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///home/site/public_html/composer.phar/src/Composer/Console/Application.php:146
Composer\Console\Application->doRun() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar:///home/site/public_html/composer.phar/src/Composer/Console/Application.php:83
Composer\Console\Application->run() at phar:///home/site/public_html/composer.phar/bin/composer:43
require() at /home/site/public_html/composer.phar:25
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]
So it seems the error appears in the post-install-cmd
when php artisan optimize
is set to run... The weird thing is that when I run all the post-install-cmd
manually, I DO NOT get any error.
So I tried :
composer selfupdate
composer dumpautoload
composer.lock
filecomposer clearcache
composer update
, on production (desperate)And still get the same error. Do you have any ideas ? I'm running out of keywords to find similar issues online.
Thanks a lot
EDIT :
Also failed to mentioned that the site is working fine.. No error when browsing.
EDIT 2 :
As per @marcanuy suggestion, I tried removing the vendor directory. While at it I also cleared compiled and composer cache. Composer re-downloaded/installed everything. And still get the same error.
EDIT 3 :
So I narrowed it down to this. I DO NOT GET THE ERROR IF I SET APP_DEBUG to true... When false, I get the error. Any idea why ?
FINAL EDIT :
Thanks to Ben Johnson who pointed me in the right direction... I checked my raw PHP logs, and yes they differ from the laravel logs (duh, should have thought of that). I saw a weird memory error in there, not related to the files in the error stack above :
[02-Jun-2015 14:05:01 Europe/Paris] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 64 bytes) in /vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 169
After the tada moment. I raised memory_limit and composer install
ran without error, and with APP_DEBUG turned OFF.
Thanks a lot to everyone for your help.
Have you examined the raw PHP logs?
It is crucial to note that Laravel's logs do not contain all of the same information that PHP's raw error logs do. When using Laravel, always check the raw PHP logs when an error occurs and the visible output and Laravel log do not reveal the root cause.
It is equally crucial to note that Composer is subject to the whims of any PHP file that it loads and processes, which means that any type of error that might occur in a PHP file that is completely unrelated to Composer is capable of causing Composer to fail, oftentimes without explanation. However, the root cause is almost always apparent in the raw PHP logs.
The empty method signature at the top of your stack-trace is unusual. I suspect that if you check the raw PHP logs, you will find some unusual condition present that fully explains the sudden termination of composer.phar
.
Please check there next and let us know what you find.
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