Installing PHP APC on GNU/Linux Centos 5


原紙:http://2bits.com/articles/installing-php-apc-gnulinux-centos-5.html
Published Mon、2008/03/24-13:49、Updated Wed、2009/07/15-23:40
Coplex PHPアプリアプリアプリ、such as Druplal、can gain a lot of performance benefits from running a PHP op-code cache/accersterators.
APC、Alternate PHP Cache、is now the most mantained free/open source op-code cache、and is being used more and more as it to be the most stable.
The instructions here detail how to get APC running on a CentOS 5 server.The server happend to have Plesk on it as well,which init me hesitant to install APC「normally」,since Plesk is sockowty
First、we need the pecl command so we can download and install APC from the repositories.
Do to so、we execute the following command:
yum install php-pear
But、this will not run on its own、we need the follwing package for the phpize command:
yum install php-devel
We also need the apps command、which is installed via the follwing package:
yum install httpd-devel
Now we have all the software we need、so we install appc via the pecl command:
pecl install apc 
Once that finishes,we need to enable able appc in Apache's configration.the following command shond shound this fors.
echo "extension=apc.so" > /etc/php.d/apc.ini
The n we retart Apache:
/etc/init.d/httpd start
And we are all done.Watch for less execution time per page,and decreasure memory usage per Apaache process compred to what you had before.
Links
You can find some addititional tips at Setting up Alternative PHP Caching APC support on Centos server.
南シナ海のIncreasung Druplal's speed via the Squid caching reverse proxy up Installing PHP APC on GNU/Linux Ubuntu Gutsy Gibron 7.10(and Debian)来源
書式
Add newコメントPecl may not be able to perform the installation
Submitted by Joe(not verifed)on Fri,2008/11/21-00:05.
Due to pecl followwing an 8 MB restication that dis regards php.ini,pecl may bomb out with a fatal error if you atempt to instal with it.You can solive this by the command'pear install pear/acp.
書式
reply Got this working on Ubuntu 7.04 Feisty
Submitted by Volomike on Sat,2008/06/14-03:53.
I already had PEAR/PECL installed on a system with Aache 2 and PHP 5,running under Ubuntu 7.04 Feisty.
$ sudo su
# apt-get update
# apt-get install php5-dev
# apt-get install apache2-prefork-dev
# apt-get install apache-dev
# pecl install apc
answer yes when prompted
# echo "extension=apc.so" >> /etc/php5/apache2/php.ini
# /etc/init.d/apache2 stop
# apt-get remove apache2
# apt-get install apache2
# /etc/init.d/apache2 stop
# /etc/init.d/apache2 start
# exit
$
At least I hope this is working.I wish I knew how to test if the performance actually increase ed.
書式
reply Trouble
Submitted by Sebastian Wikholm(not verified)on Thu,2008/06/05-07:42.
The installing with your instructions goes just fine、but APC doesnt to start for me.Appache/PHP gives the follwing error:
PHP Warning:PHP Startp:Unable to load dynamic library'/usr/lib/php/modules/app.so'-/usr/lib/php/modules/app.so:cannot open shared object file:Permission denied Unnline 0
Any help would really be apreciated
書式
reply Thanks,Khalid.I asked my
Submitted by ven kat-rk(not verifed)on Tue,2008/03/25-09:57.
Thanks、Khalid.
I asked my host to do it for me and immediately from then onwards、all my drup al pages are shwinding an internal 500 server error.
Does APC have a problem with php running as suphp(like suexec)?
Thanks,Venkat
書式
reply Doesn't work
Submitted by Khalid on Tue,2008/03/25-10:44.
Actualy I recall reading specificaally that suexec is known not to work with APC.Perhaps this because it is CGI(new process everry a request consin).The only versions that work with atwork APC theoraresphp(Apache)or Fast CGI.
In your case,suexec is a trodoff.--2 bits--Druplal consulting
書式
reply well,it seems to work:-)My
Submitted by ven kat-rk(not verifed)on Tue,2008/03/25-10:55.
well,it seems to work:-)
My host had simply given incorect permissions on the temporary APC script.I don't know the intricacies of it,but the y setup world be slight different on a cPanel VPS and enable.it.
Venkat
書式
reply suphp
Submitted by Khalid on Tue,2008/03/25-11:20.
Thanks for the email.
Your site is running suphp(which is still CGI)、and suhosin which some say is incode caches(not sure)
Please try with and without APC using devel and see if the pages execute faster with APC on suphp.I doub t the y would.--2 bits--Drup consulting
書式
reply スゲスション
Submitted by Druplal The me Garden on Tue,2008/03/25-05:24.
Nice and simple tutoral.
One question:Why APC、and not eAccellerator?In some of your previous articles(benchmarking APC vs e Accellerator using drual and PHP op code caches/accersterators:a must for a largsite)you wrote atch Acceller has better better performance.APC.
書式
reply Stbility
Submitted by Khalid on Tue,2008/03/25-10:50.
eAccellerator is definitely better than APC for speed and memory utilization(uses less memory).
However,with newer versions of PHP and Drupal,APC now has the edge in stability.Proviousy,we had mayne or two seg faults with eAcceller atweek,which wars acceptable,and the logwatch scriptatch.ttch.tch.ttres。
After ugrading、it was seg faulting every 2 houss.Once we switch ed to APC、it was stable and rock solid.
The e e e e is also xcache、which we experimented with、but not used in production work.
I plan to publish udated benchmarks of APC,eAccellerator and xcache in the near future.--2 bitts--Druplal consulting