Enabling Alternative PHP Cache (APC) extension in Zend Server CE
May 20, 2010
I spent a little bit of time yesterday trying to code up a file progress bar for a project requiring large uploads. It seems the best (and the only?) way to do this in PHP is to use an extension called the Alternative PHP Cache, which amongst other things enables file upload status support and specfically enable a switch corresponding to RFC1867 support. I’m going to show you how I did this using the Zend Server CE PHP stack on a Windows Server 2003 x86 install.
I originally thought that APC was statically compiled into Zend as it pops up in the list of extensions in the Zend dashboard:
But, on closer inspection of phpinfo()
, there was no reference to any apc directives at all.
So here is how I did it:
Enabling Alternative PHP Cache (APC) extension in Zend Server CE
- Download non-thread safe VC9 APC DLL (I went for
php_apc-5.3-nts-svn20100226-vc9-x86.zip
) from http://downloads.php.net/pierre/ - Unzip it and put the extension dll
php_apc.dll
intoC:\Program Files\Zend\ZendServer\lib\phpext
(assuming you left the Zend Server install location as its default) - Add the following to your
php.ini
(inC:\Program Files\Zend\ZendServer\etc
):
;Enable APCextension=php\_apc.dll;Enable upload progress barapc.rfc1867=on
- Give Apache/PHP a restart
Now check out phpinfo()
on the Zend dashboard and you should see something like the following, with apc and the various directives being output in the configuration part of the output.
Any of the APC file upload progress bar plugins (e.g. http://www.ibm.com/developerworks/library/os-php-v525/index.html) should now work.