When useing PHP CLI - APC crashes apache - apc_fcn

2019-09-13 06:13发布

问题:

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.

回答1:

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.