Symfony2 Composer 安装Composer

2023-09-07 08:59:45 作者:陌路人

我正在尝试安装 Symfony 2.1.3(最新).我正在运行作曲家并安装一切正常.我得到的唯一错误是:

I am trying to install Symfony 2.1.3 (latest). I am running composer and installs everything okay. The only error that I get is:

Script SensioBundleDistributionBundleComposerScriptHandler::clearCache 
handling the  post-install-cmd event terminated with an exception

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

它被安装在 www 文件夹下.我正在运行 nginx 并遵循 composer 方法.我在互联网上读到 apache 应该手动运行而不是作为服务运行,但是我使用的是 nginx.apache是​​否仍然与它有任何关系?我正在使用 debian 挤压.

It's being installed under www folder. I am running nginx and followed the composer approach. I read on internet that apache should be run manually not as a service, however I am using nginx instead. Does apache still have any bearing on it? I'm using debian squeeze.

根据 AdrienBrault 的建议,错误是因为未在 php.ini 中设置时区.只有使用 --verbose 我才能看到警告.谢谢大家.

As per AdrienBrault's suggestion the error was because the timezone was not set in the php.ini. Only with --verbose I could see the warning. Thanks guys.

推荐答案

Apache 不相关 - PHP 是通过命令行调用的.

Apache is not related - PHP is called via command line.

最有可能是缓存文件夹中的权限:你检查过运行composer update的用户是否真的可以写缓存文件夹吗?

Most likely is the permission in the cache folder: did you check if the user that runs the composer update can actually write the cache folder?

尝试手动运行rm -Rf app/cache/dev(生产环境用prod替换dev),看看有没有权限错误.

Try to manually run rm -Rf app/cache/dev (for production environment replace dev with prod) and see if you get any permission error.

如果在 CLI 中运行时未在 php 中配置 default.timezone 设置,您也会收到此错误.验证只需运行

Also you will get this error if the default.timezone setting is not configured in php when running in CLI. To verify just run

php --info |grep 时区

并检查设置 date.timezone 是否正确配置.

and check that the setting date.timezone is correctly configured.

在安全方面,将 777 设置为文件夹并不是最佳解决方案 - 如果您启用了 ACL,您可以使用它来正确设置缓存和日志文件夹的权限.在 Symfony2 官方安装页面

On the security side, setting 777 to the folder is not the optimal solution - if you have ACL enabled you could use that to correctly set up the permission for the cache and logs folder. Read more at the Symfony2 official installation page

 
精彩推荐
图片推荐