把ubuntu升级到9.10之后,突然发现apache2不监听80端口了。
查看了/var/log/apache2/里面的error.log日志,发现有一条记录:
PHP Warning: [eAccelerator] This build of "eAccelerator" was compiled for PHP version 5.2.10-2ubuntu6.3. Rebuild it for your PHP version (5.2.10-2ubuntu6.4) or download precompiled binaries.\n in Unknown on line 0
PHP Fatal error: Unable to start eAccelerator module in Unknown on line 0
那就干脆升级一下eAccelerator吧。截止本文书写之日,eAccelerator最近的版本为 0.9.6-rc1
下载eAccelerator-0.9.6-rc1:http://www.eaccelerator.net/wiki/Release-0.9.6-rc1
wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6-rc1.tar.bz2
解压缩eAccelerator:
tar jxvf eaccelerator-0.9.6-rc1.tar.bz2
进入eAccletator的目录:
cd eaccelerator-0.9.6-rc1/
运行如下几个指令(一行一个指令,等执行完了再输入下一个):
phpize
sudo ./configure --enable-eaccelerator=shared
sudo make
sudo make install
安装好之后,屏幕会显示大概如下信息:
Installing shared extensions: /usr/lib/php5/20060613+lfs/
修改php.ini和建立并设置/var/cache/eaccelerator目录的权限。具体的请看之前的文章:
https://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html
最后步骤:升级control.php文件
eaccelerator-0.9.6-rc1的control.php和我们之前介绍的eaccelerator-0.9.5.3的control.php文件内容已经不同。所以无法继续使用旧版本的control.php文件。
所以,我们先复制新版本的control.php去覆盖掉旧版本的:
sudo cp control.php /var/www/control.php
新版本的control.php默认是无需账号密码即可查看。所以我们对control.php做如下修改:
先用vi指令编辑control.php:
sudo vi /var/www/control.php
大概19-23行的内容如下:
/*** CONFIG ***/
$auth = false; // Set to false to disable authentication
$user = "admin";
$pw = "eAccelerator";
为了安全起见,我们把这些修改为:
/*** CONFIG ***/
$auth = true; // Set to false to disable authentication
$user = "管理账号";
$pw = "管理密码";
然后保存退出,这样当有人访问control.php的时候,就需要输入管理账号和管理密码了。
然后,老习惯,检查一下apache2的配置和重新一下apache2:
apache2ctl configtest
sudo /etc/init.d/apache2 restart
如果没看到错误信息,基本大功告成了。
本日志作为:施炜煜
原文地址:https://firefore.com/2010/01/ubuntu9-10-eaccelerator.html