Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.2 artisan optimize - php_strip_whitespace failed to open stream: No child processes

Since upgrading to Laravel 5.2 from 5.1, when running artisan optimize on CircleCI, running PHP 5.6.14, I am getting

[ErrorException]                                                                                 
php_strip_whitespace(/var/laravel/project/root): failed to open stream: No child processes

Where /var/laravel/project/root is the directory where composer.json and vendor reside.

The command runs fine on my dev box running PHP 5.6.11-1ubuntu3.1. I followed the official 5.1 to 5.2 upgrade guide.

Exception trace:
() at /var/laravel/project/root/vendor/classpreloader/classpreloader/src/ClassPreloader.php:124
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a
php_strip_whitespace() at /var/laravel/project/root/vendor/classpreloader/classpreloader/src/ClassPreloader.php:124
ClassPreloader\ClassPreloader->getCode() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:83
Illuminate\Foundation\Console\OptimizeCommand->compileClasses() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:64
Illuminate\Foundation\Console\OptimizeCommand->fire() at n/a:n/a
call_user_func_array() at /var/laravel/project/root/bootstrap/cache/compiled.php:1217
Illuminate\Container\Container->call() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
Illuminate\Console\Command->execute() at /var/laravel/project/root/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
Illuminate\Console\Command->run() at /var/laravel/project/root/vendor/symfony/console/Application.php:787
Symfony\Component\Console\Application->doRunCommand() at /var/laravel/project/root/vendor/symfony/console/Application.php:186
Symfony\Component\Console\Application->doRun() at /var/laravel/project/root/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at /var/laravel/project/root/artisan:36

Any ideas on how I can resolve this please?

like image 428
Dave Southey Avatar asked Jan 08 '16 16:01

Dave Southey


1 Answers

I found the answer on https://laracasts.com/discuss/channels/laravel/laravel-optimize-error where johnwheal mentions that config/compile.php is wrong.

It turns out that the files array in config/compile.php was emptied in a commit in April 2015 but I can't see the change mentioned in the Upgrade Guide. It has since been added to the Upgrade Guide.

To fix the problem either:

  • Empty the files array in config/compile.php

or

  • Remove BusServiceProvider.php and ConfigServiceProvider.php from the files array in config/compile.php .
like image 154
Dave Southey Avatar answered Nov 04 '22 17:11

Dave Southey