【问题标题】:"Unable to kill the process" error with "php composer.phar install" on AzureAzure 上的“php composer.phar install”出现“无法终止进程”错误
【发布时间】:2015-07-28 09:13:48
【问题描述】:

我正在尝试将我的 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.dllswitch,因为扩展已经加载。其实我都试过了,没啥区别。

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

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

我尝试增加 max_execution_time(但它无论如何都设置为 0),还尝试将 app_settings 中的 SCM_COMMAND_IDLE_TIMEOUT 参数设置为 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

【问题讨论】:

  • 要按照您的指南,向下滚动到有关数据库连接字符串的部分。在作曲家安装过程中,控制台会提示问题。你是回答还是不回答?
  • 我已经回答了这些问题。但我必须尽快回答。如果我等待的时间过长,我猜大概是 30 秒,那么脚本会以 [RuntimeException] Aborted 消息中止。也许这有助于找到原因
  • 它在尝试运行exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode);时似乎超时过程,您应该检查没有pid冲突,或者您可以重新启动Azure(如果可能)并重试。

标签: php symfony azure


【解决方案1】:

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

1,在 Azure 上创建一个带有 MySQL 数据库的 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、回答composer安装过程中的提示问题。

对我来说很好用。

顺便说一句,当作曲家清理项目环境中的缓存时,超时 RuntimeException 似乎有问题。有两种处理方式:

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

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

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

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

【讨论】:

  • 我完全按照您的步骤操作,但又遇到了同样的错误。清理缓存时出现无法终止进程异常。有了一个干净的新 web 应用程序和一个干净的新 symfony 项目......
  • 实际上,当我可以重现您的问题时,我将process-timeout 设置为一个非常小的数字,例如 2。所以我怀疑这是问题的关键。您是否尝试将process-timeout 设置为很大的数字?
  • 我尝试将进程超时设置为 0 和 3600。在这两种情况下都是同一个问题。
【解决方案2】:

我在尝试重现它时遇到了同样的错误。安装这两个项目导致超时:

"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",

尝试了解决方法:

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

  2. 把这两个组件加回来,重新安装,就成功了。

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

【讨论】:

    【解决方案3】:

    仅供参考

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

    【讨论】:

      【解决方案4】:

      仅供参考

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

      要在 Azure 上安装,请按照 Windows 的下载说明进行操作。希望对您有所帮助。

      【讨论】:

        猜你喜欢
        • 2019-07-20
        • 2015-11-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多