脚本宝典收集整理的这篇文章主要介绍了php – symfony / process – 静默处理而不启动,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
考虑一下这个控制器代码:
<?PHP namespace AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\component\HttpFoundation\JsonResponse; use Symfony\Component\PRocess\Process; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; class CommandController extends Controller { /** * @Route("/command") * @return JsonResponse */ public function commandAction () { $rootDir = $this->get('kernel')->getRootDir(); $env = $this->get('kernel')->getEnvironment(); $commandline = $rootDir . '/console --env=' . $env . ' acme:hello --who jojo' $process = new Process($commandline); $process->start(); return new JsonResponse(array('command' => $commandline)); } }
当我向/ command发出请求时,我得到了我的预期结果并且该过程开始,例如我用htop之类的东西看到了它.
当我再次发出此请求时,我得到了我的预期结果,但是要启动的进程不会出现在任何地方.没有错误,没有任何错误.
重新启动PHP5-fpm服务使我能够再次通过请求启动一个进程,所以基本上我需要在每次请求后重新启动整个PHP服务.所以这可能不是编程问题.但老实说,我还不知道.
问题是在Symfony2 – process launching a symfony2 command之前的stackoverflow上描述的,但exec的解决方法对我不起作用.
有人有线索吗?
感谢和问候,
乔乔
以上是脚本宝典为你收集整理的php – symfony / process – 静默处理而不启动全部内容,希望文章能够帮你解决php – symfony / process – 静默处理而不启动所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。