在Symfony2的共享主机上使用Composer安装/更新运行时异常

时间:2012-12-30 16:42:34

标签: php symfony shared-hosting composer-php

我似乎在共享主机上遇到了一些缓存权限问题。具体来说,当我尝试通过Composer安装/更新供应商时,我得到一个运行时异常:

$ php composer.phar update -v -o

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

[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.

Exception trace:
() at /home/thesewingdiva/private/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:137
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand() at /home/thesewingdiva/private/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:48
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache() at phar:///home/thesewingdiva/private/composer.phar/src/Composer/Script/EventDispatcher.php:122
Composer\Script\EventDispatcher->executeEventPhpScript() at phar:///home/thesewingdiva/private/composer.phar/src/Composer/Script/EventDispatcher.php:101
Composer\Script\EventDispatcher->doDispatch() at phar:///home/thesewingdiva/private/composer.phar/src/Composer/Script/EventDispatcher.php:74
Composer\Script\EventDispatcher->dispatchCommandEvent() at phar:///home/thesewingdiva/private/composer.phar/src/Composer/Installer.php:237
Composer\Installer->run() at phar:///home/thesewingdiva/private/composer.phar/src/Composer/Command/UpdateCommand.php:82
Composer\Command\UpdateCommand->execute() at phar:///home/thesewingdiva/private/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:238
Symfony\Component\Console\Command\Command->run() at phar:///home/thesewingdiva/private/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:193
Symfony\Component\Console\Application->doRun() at phar:///home/thesewingdiva/private/composer.phar/src/Composer/Console/Application.php:101
Composer\Console\Application->doRun() at phar:///home/thesewingdiva/private/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:106
Symfony\Component\Console\Application->run() at phar:///home/thesewingdiva/private/composer.phar/src/Composer/Console/Application.php:74
Composer\Console\Application->run() at phar:///home/thesewingdiva/private/composer.phar/bin/composer:37
require() at /home/thesewingdiva/private/composer.phar:15

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

我没有能力使用ACL,因为它是共享主机,所以我无法使用sudo。缓存设置为777,因为它的权限(递归),app / console,app.php和app_dev.php都有umask(0000)。我还删除了缓存,看看是否有帮助。没有骰子。关于如何解决这个问题的任何想法?

3 个答案:

答案 0 :(得分:4)

this question下的评论中,指出该问题与缺少时区设置有关。

  

如果您执行“php app / console cache:clear --verbose”

会发生什么

答案 1 :(得分:2)

我有一段时间同样的问题,经过几个小时的面对面的敲击,我意识到......我的项目中有一个.gitmodule,在初始结账时这些子模块没有初始化,因此不适用于你的作曲家要更新,这会导致上述错误。

确保运行以下

git submodule update --init src/Acme/Sadness/Bundle

当然用您的项目命名空间替换 src / Acme / Sadness / Bundle

希望这有助于某人不会经历我刚才所做的同样的痛苦。

答案 2 :(得分:0)

要找出异常的确切原因,请参阅php错误日志。 但是,如Jared Farrish所述,这可能是因为没有在php ini设置中设置时区。

#/etc/php5/cli/php.ini
date.timezone = 'Asia/Kolkata'
log_errors = On
error_log = /var/log/php/error.log