使用PHP CLI时-APC使Apache崩溃-apc_fcntl_lock失败errno:6 [英] When useing PHP CLI - APC crashes apache - apc_fcntl_lock failed errno:6
问题描述
我已经解决了这个问题,但是我将其发布在这里以供将来参考,也许它会帮助某人:)
问题:
使用自定义php.ini从命令行运行PHP后,Apache崩溃并抛出此错误apc_fcntl_lock failed errno:6
.
我的配置:
我已经安装了带PHP 5.3.8和APC的easyPHP.
APC对于由easyPHP(Apache服务器)运行的应用程序运行正常.
我正在使用Symfony2框架,它带有从命令行运行的漂亮代码生成器,例如:php app/console doctrine:database:create
,它连接到MySQL并为我创建数据库.
要运行这些命令,我需要启用pdo_mysql扩展.由于默认情况下PHP CLI没有启用pdo_mysql,因此我已将php.ini复制到C:\Windows\php.ini
(这是PHP CLI查找php.ini的位置).
但是我还启用了许多其他扩展(例如php_intl或php_curl,php_gd2等)和php_apc.
解决方案:
我的symfony2应用程序由easyPHP运行,该PHP加载了C:\easyPHP\conf_files\php.ini
(这是我的easyPHP apache服务器的php.ini),在那儿我保持了php_apc的启用状态.
对我来说,解决方案是禁用在C:\Windows\php.ini
中的php_apc(这是我的PHP CLI [命令行界面] php.ini).
这样-symfony2可以使用APC运行得更快,而且我可以使用命令行来生成代码,而不必每次都重新启动Apache.
I've already solved the problem, but I'll post it here for future reference and maybe it will help someone :)
The Problem:
After running PHP from command line with custom php.ini Apache crashes and throws this error apc_fcntl_lock failed errno:6
.
My configuration:
I've got easyPHP with PHP 5.3.8 and APC installed.
APC works fine for my applications run by easyPHP (Apache server).
I am useing Symfony2 framework and it comes out with nice code generators run from command line, for example: php app/console doctrine:database:create
which connects to MySQL and creates a database for me.
To run these commands I need pdo_mysql extension enabled. Since PHP CLI by default does not have pdo_mysql enabled I've copied my php.ini into C:\Windows\php.ini
(this is where PHP CLI looks for php.ini).
But I had lots of other extensions enabled (like php_intl or php_curl, php_gd2, ...) and php_apc among them.
The solution:
My symfony2 application is run by easyPHP which loads C:\easyPHP\conf_files\php.ini
(this is my php.ini for easyPHP apache server) and there I left php_apc enabled.
For me, the solution was to disable php_apc in C:\Windows\php.ini
(this is my php.ini for PHP CLI [command line interface]).
This way - symfony2 can use APC to run faster, and I can use the command line to generate code without having to restart Apache every time.
这篇关于使用PHP CLI时-APC使Apache崩溃-apc_fcntl_lock失败errno:6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!