ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Installing PHP APC on GNU/Linux Centos 5

2019-01-20 12:03:06  阅读:463  来源: 互联网

标签:php Centos GNU Installing install apc APC 2008 PHP


               

原贴: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   

Complex PHP applications, such as Drupal, can gain a lot of performance benefits from running a PHP op-code cache/accelerators.

APC,
Alternate PHP Cache, is now the most maintained free/open sourceop-code cache, and is being used more and more as it emerges to be the
most stable.

The instructions here detail how to get APC running on a CentOS 5server. The server happened to have Plesk on it as well, whichinitially made me hesitant to install APC "normally", since Plesk is sopicky on what other software is installed on the server. However, itseems to have worked out well.

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 following package for the phpize command:

yum install php-devel

We also need the apxs command, which is installed via the following package:

yum install httpd-devel

Now we have all the software we need, so we install apc via the pecl command:

pecl install apc 

Once that finishes, we need to enable apc in Apache's configuration. the following command should do this for us.

echo "extension=apc.so" > /etc/php.d/apc.ini

Then we restart Apache:

/etc/init.d/httpd start

And we are all done. Watch for less execution time per page,and decreased memory usage per Apache process compared to what you had
before.

Links

You can find some additional tips at Setting up Alternative PHP Caching APC support on Centos server.

              ‹ Increasing Drupal's speed via the Squid caching reverse proxy                    up                    Installing PHP APC on GNU/Linux Ubuntu Gutsy Gibbon 7.10 (and Debian) ›          »

Pecl may not be able to perform the installation

Submitted by Joe (not verified) on Fri, 2008/11/21 - 00:05.

Dueto pecl following an 8 MB restriction that disregards php.ini, pecl maybomb out with a fatal error if you attempt to install apc with it. Youcan solve this by using the command 'pear install pecl/acp' instead.

»

Got this working on Ubuntu 7.04 Feisty

Submitted by Volomike (not verified) on Sat, 2008/06/14 - 03:53.

I already had PEAR/PECL installed on a system with Apache2 and PHP5, 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 increased.

»

Trouble

Submitted by Sebastian Wikholm (not verified) on Thu, 2008/06/05 - 07:42.

Theinstalling with your instructions goes just fine, but APC doesnt wantto start for me. Apache / PHP gives the following error:

PHP Warning: PHP Startup: Unable to load dynamic library'/usr/lib/php/modules/apc.so' - /usr/lib/php/modules/apc.so: cannotopen shared object file: Permission denied in Unknown on line 0

Any help would really be appreciated

»

Thanks, Khalid.I asked my

Submitted by venkat-rk (not verified) 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 drupal pages are showing an internal 500 server error.

Does APC have a problem with php running as suphp (like suexec)?

Thanks,
Venkat

»

Doesn't work

Submitted by Khalid on Tue, 2008/03/25 - 10:44.

ActuallyI recall reading specifically that suexec is known not to work withAPC. Perhaps this is because it is CGI (new process every time arequest comes in). The only versions that work with APC and otheraccelerators are the mod_php (Apache) or Fast CGI.

In your case, suexec is a trade off (security vs. performance).
--
2bits -- Drupal consulting

»

well, it seems to work:-)My

Submitted by venkat-rk (not verified) on Tue, 2008/03/25 - 10:55.

well, it seems to work:-)

My host had simply given incorrect permissions on the temporary APCscript. I don't know the intricacies of it, but they said setup wouldbe slightly different on a cPanel VPS and enabled it.

Venkat

»

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 incompatible with op-code caches (not sure).

Please try with and without APC using devel and see if the pages execute faster with APC on suphp. I doubt they would.
--
2bits -- Drupal consulting

»

suggestion

Submitted by Drupal Theme Garden (not verified) on Tue, 2008/03/25 - 05:24.

Nice and simple tutorial.

One question:
Why APC, and not eAccelerator?
In some of your previous articles (benchmarking APC vs eAccelerator using drupal and PHP op code caches/accelerators: a must for a large site) you wrote that eAccelerator has better performance over APC.

»

Stability

Submitted by Khalid on Tue, 2008/03/25 - 10:50.

eAccelerator is definitely better than APC for speed (faster) and memory utilization (uses less memory).

However, with newer versions of PHP and Drupal, APC now has the edgein stability. Previously, we had maybe one or two seg faults witheAccelerator per week, which was acceptable, and the logwatcher scriptrestarted things automatically.

After upgrading, it was seg faulting every 2 hours. Once we switched to APC, it was stable and rock solid.

There is also xcache, which we experimented with, but not used in production work.

I plan to publish updated benchmarks of APC, eAccelerator and xcache in the near future.
--
2bits -- Drupal consulting

 

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

标签:php,Centos,GNU,Installing,install,apc,APC,2008,PHP
来源: https://blog.csdn.net/sdfshfh/article/details/86560741

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有