Installing PHP APC on GNU/Linux Centos 5

2023-11-07 17:32
文章标签 linux php centos gnu apc installing

本文主要是介绍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   

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.

Pecl may not be able to perform the installation

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

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

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

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

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

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

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

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

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

这篇关于Installing PHP APC on GNU/Linux Centos 5的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/365206

相关文章

Linux中shell解析脚本的通配符、元字符、转义符说明

《Linux中shell解析脚本的通配符、元字符、转义符说明》:本文主要介绍shell通配符、元字符、转义符以及shell解析脚本的过程,通配符用于路径扩展,元字符用于多命令分割,转义符用于将特殊... 目录一、linux shell通配符(wildcard)二、shell元字符(特殊字符 Meta)三、s

Linux之软件包管理器yum详解

《Linux之软件包管理器yum详解》文章介绍了现代类Unix操作系统中软件包管理和包存储库的工作原理,以及如何使用包管理器如yum来安装、更新和卸载软件,文章还介绍了如何配置yum源,更新系统软件包... 目录软件包yumyum语法yum常用命令yum源配置文件介绍更新yum源查看已经安装软件的方法总结软

linux报错INFO:task xxxxxx:634 blocked for more than 120 seconds.三种解决方式

《linux报错INFO:taskxxxxxx:634blockedformorethan120seconds.三种解决方式》文章描述了一个Linux最小系统运行时出现的“hung_ta... 目录1.问题描述2.解决办法2.1 缩小文件系统缓存大小2.2 修改系统IO调度策略2.3 取消120秒时间限制3

Linux alias的三种使用场景方式

《Linuxalias的三种使用场景方式》文章介绍了Linux中`alias`命令的三种使用场景:临时别名、用户级别别名和系统级别别名,临时别名仅在当前终端有效,用户级别别名在当前用户下所有终端有效... 目录linux alias三种使用场景一次性适用于当前用户全局生效,所有用户都可调用删除总结Linux

Linux:alias如何设置永久生效

《Linux:alias如何设置永久生效》在Linux中设置别名永久生效的步骤包括:在/root/.bashrc文件中配置别名,保存并退出,然后使用source命令(或点命令)使配置立即生效,这样,别... 目录linux:alias设置永久生效步骤保存退出后功能总结Linux:alias设置永久生效步骤

Linux使用fdisk进行磁盘的相关操作

《Linux使用fdisk进行磁盘的相关操作》fdisk命令是Linux中用于管理磁盘分区的强大文本实用程序,这篇文章主要为大家详细介绍了如何使用fdisk进行磁盘的相关操作,需要的可以了解下... 目录简介基本语法示例用法列出所有分区查看指定磁盘的区分管理指定的磁盘进入交互式模式创建一个新的分区删除一个存

Linux使用dd命令来复制和转换数据的操作方法

《Linux使用dd命令来复制和转换数据的操作方法》Linux中的dd命令是一个功能强大的数据复制和转换实用程序,它以较低级别运行,通常用于创建可启动的USB驱动器、克隆磁盘和生成随机数据等任务,本文... 目录简介功能和能力语法常用选项示例用法基础用法创建可启动www.chinasem.cn的 USB 驱动

高效管理你的Linux系统: Debian操作系统常用命令指南

《高效管理你的Linux系统:Debian操作系统常用命令指南》在Debian操作系统中,了解和掌握常用命令对于提高工作效率和系统管理至关重要,本文将详细介绍Debian的常用命令,帮助读者更好地使... Debian是一个流行的linux发行版,它以其稳定性、强大的软件包管理和丰富的社区资源而闻名。在使用

Linux Mint Xia 22.1重磅发布: 重要更新一览

《LinuxMintXia22.1重磅发布:重要更新一览》Beta版LinuxMint“Xia”22.1发布,新版本基于Ubuntu24.04,内核版本为Linux6.8,这... linux Mint 22.1「Xia」正式发布啦!这次更新带来了诸多优化和改进,进一步巩固了 Mint 在 Linux 桌面

LinuxMint怎么安装? Linux Mint22下载安装图文教程

《LinuxMint怎么安装?LinuxMint22下载安装图文教程》LinuxMint22发布以后,有很多新功能,很多朋友想要下载并安装,该怎么操作呢?下面我们就来看看详细安装指南... linux Mint 是一款基于 Ubuntu 的流行发行版,凭借其现代、精致、易于使用的特性,深受小伙伴们所喜爱。对