|
||||
|
« bad interpreter: No such file or directory | Install APC on Windows XP » |
Alternative PHP Cache (APC)
by: admin - May 05, 2006
Since 2003, I have been using a PHP optimiser in one form or another. My favourite back then was Turck MMCache for PHP and it was excellent. Unfortunately, the project was abandoned sometime in 2004 because the lead developer was hired by Zend Technologies, if I am not mistaken. For much of 2005, I didn't use any PHP optimizer at all... until recently, when I decided to try installing APC instead. Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Below are my notes about installing APC on my Linux Web Hosting Server. My server is powered by CentOS 4.+ and I am using Apache 1.3+ with PHP 4.4+. More information about APCYou can, of course, read more about APC at PHP.net and also by visiting the PECL web site. Install APC on Linux (CentOS)Download APC (replace 'APC-n.n.nn.tgz' below with the correct version number for the latest release e.g. 'APC-3.0.10.tgz'): Generic Code Example: [root@server src]$ wget http://pecl.php.net/get/APC-n.n.nn.tgz Next, you have to extract the files: Generic Code Example: [root@server src]$ gunzip -c APC-n.n.nn.tgz | tar xf - Change directory: Generic Code Example: [root@server src]$ cd APC-n.n.nn Read the INSTALL file: Generic Code Example: [root@server APC-n.n.nn]$ cat ./INSTALL | less Despite this tutorial, you should always read the INSTALL file. It contains all the (latest) information for you to install APC to your web server. I used the "QUICK INSTALL (DSO)" method for installing APC on my web server. Before you even proceed further, what I can suggest you may want to do next is to find the location of the following files / programmes inside your Linux web server (using the most convenient command: locate, find or whereis):
You will be using the paths in the (example) command lines described below. Once you have all the folder information (above) ready, you can start the process of installing APC on your Linux (CentOS) web server. Generic Code Example: [root@server APC-n.n.nn]$ /usr/local/bin/phpize [root@server APC-n.n.nn]$ export CPPFLAGS="-I/usr/include/apache -DAPC_PHP4_STAT" [root@server APC-n.n.nn]$ ./configure --enable-apc --enable-apc-mmap --with-apxs=/usr/sbin/apxs --with-php-config=/usr/local/bin/php-config [root@server APC-n.n.nn]$ make [root@server APC-n.n.nn]$ make install Tip: Edit php.iniOpen your php.ini file. On my server, php.ini is located at /usr/local/lib/php.ini. Change the default extension directory if you've never set it before: Generic Code Example: ; Directory in which the loadable extensions (modules) reside. ; extension_dir = "./" extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20020429/" Notice how I commented out the second line and inserted a new value for the extension_dir setting. Scroll down the file and insert the following 2 lines to your php.ini file: Generic Code Example: extension = "apc.so" apc.shm_size = 32 ;Windows Extensions ;Note that MySQL and ODBC support is now built in, so no dll is needed for it. ; Again, lines no. 1 & 2 are what I inserted to the file. Once this is complete, save and close the file. Restart Web ServerNext, simply restart your Apache web server. Generic Code Example: [root@server APC-n.n.nn]$ /sbin/service httpd restart Verifying / Monitoring APCIf everything was done correctly, you should see a section for APC inside your phpinfo page. Also, you should copy the apc.php page to a suitable location on your web site. For example www.example.com/reports/apc.php: Generic Code Example: [root@server APC-n.n.nn]$ cp ./apc.php /home/jds/domains/example.com/public_html/reports/apc.php [root@server APC-n.n.nn]$ chown jds:jds /home/jds/domains/example.com/public_html/reports/apc.php Warning:
|
GIDNetwork Sites
Archives
Recent GIDBlog Posts
Recent GIDForums Posts
Contact Us
|
« bad interpreter: No such file or directory | Install APC on Windows XP » |