问题 Azure上的“php composer.phar install”错误“无法终止进程”错误


我正在尝试将我的Symfony 2应用程序部署到Microsoft Azure网站云。 为此,我按照本指南中的步骤操作 http://symfony.com/doc/current/cookbook/deployment/azure-website.html#configure-the-symfony-application

现在,当我进入“配置Symfony应用程序”步骤时,我运行命令 php composer.phar install。我省略了 -d extension=php_intl.dll切换为已加载扩展名。我实际上尝试了两者,它没有任何区别。

现在,在运行安装后命令时,我收到以下错误:

[Symfony\Component\Process\Exception\RuntimeException]
Unable to kill the process                              

我尝试增加max_execution_time(但无论如何都设置为0)并尝试设置 SCM_COMMAND_IDLE_TIMEOUT app_settings中的参数为3600之类的值。仍然无法正常工作。

有任何想法吗? 这是完整的输出:

D:\home\site\wwwroot>php composer.phar install
 Loading composer repositories with package information

Installing dependencies (including require-dev) from lock file

Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.

Nothing to install or update

Generating autoload files

> Incenteev\ParameterHandler\ScriptHandler::buildParameters

Updating the "app/config/parameters.yml" file

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception







  [Symfony\Component\Process\Exception\RuntimeException]  

  Unable to kill the process                              







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]






Fatal error: Uncaught exception 'Symfony\Component\Process\Exception\RuntimeException' with message 'Unable to kill the process' in phar://D:/home/site/wwwroot    /composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php:801
Stack trace:
#0 phar://D:/home/site/wwwroot/composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php(177): Symfony\Component\Process\Process->stop()
#1 [internal function]: Symfony\Component\Process\Process->__destruct()
#2 {main}
  thrown in phar://D:/home/site/wwwroot/composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php on line 801

12910
2017-07-28 09:13


起源

要按照指南操作,请向下滚动到有关数据库连接字符串的部分。控制台将在编辑器安装过程中提示问题。你有答案还是放下它? - Gary Liu - MSFT
我已经回答了这些问题。但我必须尽快回答。如果我等待太久,我猜大约30秒,然后脚本以[RuntimeException] Aborted消息中止。也许这有助于找到原因 - Nik
尝试运行时它似乎是超时过程 exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode); 你应该检查没有pid冲突,或者你可以重新启动Azure(如果可能的话),然后再试一次。 - hendrathings


答案:


我试图重现你的问题,但是失败了,作曲家在我的Azure项目中运行良好。请尝试以下步骤:

1,使用MySQL数据库在Azure上创建Web应用程序,并从git设置部署。

2,在cmdlet本地创建一个新的symfony 2.7项目:

php -r "readfile('http://symfony.com/installer');" > symfony

symfony new my_project

然后在Web应用程序上部署项目。

3,切换回Kudu应用程序的在线控制台,执行以下命令:

"cd site\wwwroot"

"curl -sS https://getcomposer.org/installer | php"

"php composer.phar install"

4,在作曲家安装过程中回答提示问题。

它对我来说很好。

顺便说一句,当作曲家清理项目环境中的缓存时,似乎有一些关于超时RuntimeException的错误。有两种方法可以处理它:

1,我们可以在Azure上部署之前手动清理缓存。

2,我们可以设置命令执行超时选项 composer.json。在composer.Json文件中,有代码:

"config": {
   "bin-dir": "bin",
   "process-timeout":0 
}, 

我们添加“process-timeout:0”来消除命令执行时间的限制。


3
2017-08-03 05:30



我完全按照你的步骤,再次遇到同样的错误。清理缓存时,我无法终止进程异常。有了一个干净的新webapp和一个干净的新symfony项目...... - Nik
实际上,我订了 process-timeout 当我可以重现你的问题时,我会想到一个非常小的数字。所以我怀疑这是问题的关键。你试过试试吗? process-timeout 大量的? - Gary Liu - MSFT
我尝试将process-timeout设置为0以及3600.在两种情况下都是同样的问题。 - Nik


在尝试重新编写时我遇到了同样的错误。超时是由安装这两个项目引起的:

“Sensio公司\包\ DistributionBundle \作曲\ ScriptHandler :: clearCache” “Sensio公司\包\ DistributionBundle \作曲\ ScriptHandler :: installAssets”

试过一个解决方法:

  1. 从composer.json中删除ClearCache和InstallAsset,安装成功

  2. 重新添加这两个组件,再次安装,它工作。

  3. 有一个关于符号链接的警告,因为Windows不支持符号链接。这应该是不同的问题。


3
2017-08-07 22:39





FYI

我再测试一次,看起来像composer.lock引起了一些问题。我删除了composer.lock,然后运行install,它成功通过了。


3
2017-08-10 18:15



我刚试过这个,但它也没有帮助。 - Nik


FYI

这是官方的Symfony下载站点, https://symfony.com/doc/current/book/installation.html#installing-the-symfony-installer 

要在Azure上安装,请按照Windows的下载说明进行操作。希望它可以提供帮助。


3
2017-08-12 14:40