Laravel 5.2工匠优化 - php_strip_whitespace无法打开流:没有子进程

时间:2016-01-08 16:20:22

标签: php laravel laravel-5 laravel-5.2 circleci

从5.1升级到Laravel 5.2后,在CircleCI上运行 artisan optimize ,运行PHP 5.6.14时,我正在

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

/ var / laravel / project / root 是composer.json和供应商所在的目录。

该命令在运行PHP 5.6.11-1ubuntu3.1的开发盒上运行正常。我按照官方的5.1到5.2升级指南进行了操作。

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

关于我如何解决这个问题的任何想法?

2 个答案:

答案 0 :(得分:9)

我在https://laracasts.com/discuss/channels/laravel/laravel-optimize-error找到答案,其中johnwheal提到config/compile.php错误。

事实证明,config/compile.php中的文件数组在2015年4月的提交中被清空,但我看不到升级指南 。它已添加到升级指南

要解决问题:

  • 清空config/compile.php
  • 中的文件数组

  • BusServiceProvider.php中的files数组中删除ConfigServiceProvider.phpconfig/compile.php

答案 1 :(得分:0)

此错误的原因是ConfigServiceProviderBusServiceProvider已被删除,这是5.1到5.2过渡的一部分。虽然为删除所有已编译的类而提供的答案将解决问题,但您需要从ConfigServiceProvider中删除的只有config/compile.php 'files' => [ realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'), realpath(__DIR__.'/../app/Providers/BusServiceProvider.php'), // This one realpath(__DIR__.'/../app/Providers/ConfigServiceProvider.php'), // And this one realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'), realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'), ],

{{1}}