Getting APC for playing with spl_autoload_register

I use Zend autoloader to load Zend classes to integrate Zend_AMF with my application. Everything worked fine until I installed APC 3.1.9 and turned it on.

I get this error:

Fatal error: Access to undeclared static property: Zend_Loader_Autoloader::$_instance in C:\blahblah 

I assume that APC seems to have problems with autoloaders and static properties and static methods.

APC is version 3.1.9 and is installed on a computer running Windows 7 with PHP 5.3.8 running as fastCGI on an Apache 2.2 server.

Has anyone seen this error before? If so, what are some ways to fix this?

+7
source share
1 answer

It seems that this is actually not an autoloader error. APC sometimes does not play well if you have your own session handler.

The trick is to add this to the earliest part of your script (turn it on the first time you turn it on): register_shutdown_function('session_write_close');

This will tell PHP that it will finish writing and closing (not destroying!) The session when the script terminates or terminates (using exit (), etc.).

+10
source

All Articles