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-基础知识3

打包和压缩 zip 安装zip软件包 yum -y install zip unzip 压缩打包命令: zip -q -r -d -u 压缩包文件名 目录和文件名列表 -q:不显示命令执行过程-r:递归处理,打包各级子目录和文件-u:把文件增加/替换到压缩包中-d:从压缩包中删除指定的文件 解压:unzip 压缩包名 打包文件 把压缩包从服务器下载到本地 把压缩包上传到服务器(zip

Linux 网络编程 --- 应用层

一、自定义协议和序列化反序列化 代码: 序列化反序列化实现网络版本计算器 二、HTTP协议 1、谈两个简单的预备知识 https://www.baidu.com/ --- 域名 --- 域名解析 --- IP地址 http的端口号为80端口,https的端口号为443 url为统一资源定位符。CSDNhttps://mp.csdn.net/mp_blog/creation/editor

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

Linux_kernel驱动开发11

一、改回nfs方式挂载根文件系统         在产品将要上线之前,需要制作不同类型格式的根文件系统         在产品研发阶段,我们还是需要使用nfs的方式挂载根文件系统         优点:可以直接在上位机中修改文件系统内容,延长EMMC的寿命         【1】重启上位机nfs服务         sudo service nfs-kernel-server resta

【Linux 从基础到进阶】Ansible自动化运维工具使用

Ansible自动化运维工具使用 Ansible 是一款开源的自动化运维工具,采用无代理架构(agentless),基于 SSH 连接进行管理,具有简单易用、灵活强大、可扩展性高等特点。它广泛用于服务器管理、应用部署、配置管理等任务。本文将介绍 Ansible 的安装、基本使用方法及一些实际运维场景中的应用,旨在帮助运维人员快速上手并熟练运用 Ansible。 1. Ansible的核心概念

Linux服务器Java启动脚本

Linux服务器Java启动脚本 1、初版2、优化版本3、常用脚本仓库 本文章介绍了如何在Linux服务器上执行Java并启动jar包, 通常我们会使用nohup直接启动,但是还是需要手动停止然后再次启动, 那如何更优雅的在服务器上启动jar包呢,让我们一起探讨一下吧。 1、初版 第一个版本是常用的做法,直接使用nohup后台启动jar包, 并将日志输出到当前文件夹n

[Linux]:进程(下)

✨✨ 欢迎大家来到贝蒂大讲堂✨✨ 🎈🎈养成好习惯,先赞后看哦~🎈🎈 所属专栏:Linux学习 贝蒂的主页:Betty’s blog 1. 进程终止 1.1 进程退出的场景 进程退出只有以下三种情况: 代码运行完毕,结果正确。代码运行完毕,结果不正确。代码异常终止(进程崩溃)。 1.2 进程退出码 在编程中,我们通常认为main函数是代码的入口,但实际上它只是用户级

【Linux】应用层http协议

一、HTTP协议 1.1 简要介绍一下HTTP        我们在网络的应用层中可以自己定义协议,但是,已经有大佬定义了一些现成的,非常好用的应用层协议,供我们直接使用,HTTP(超文本传输协议)就是其中之一。        在互联网世界中,HTTP(超文本传输协议)是一个至关重要的协议,他定义了客户端(如浏览器)与服务器之间如何进行通信,以交换或者传输超文本(比如HTML文档)。

如何编写Linux PCIe设备驱动器 之二

如何编写Linux PCIe设备驱动器 之二 功能(capability)集功能(capability)APIs通过pci_bus_read_config完成功能存取功能APIs参数pos常量值PCI功能结构 PCI功能IDMSI功能电源功率管理功能 功能(capability)集 功能(capability)APIs int pcie_capability_read_wo