Ubuntu 上安装buildix,PHP5, Apache2
一开始,我在计算机上安装了buildix,发现 Buildix的各项功能也能正确运行。但是,一旦我安装并启用了 php5和mod-php5,就会导致buildix被卸载。如下:
liuzhr@suowan-master:/etc/apache2/sites-enabled$ sudo apt-get install php5 libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5 is already the newest version.
The following packages were automatically installed and are no longer required:
python-libxslt1 libapache2-svn libapache2-mod-python sun-java5-jdk python-libxml2 python-svn libapache2-mod-fastcgi cruisecontrol sun-java5-demo
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
apache2-mpm-prefork
The following packages will be REMOVED:
apache2-mpm-worker buildix
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5
0 upgraded, 2 newly installed, 2 to remove and 60 not upgraded.
Need to get 0B/2978kB of archives.
After unpacking 5747kB of additional disk space will be used.
Do you want to continue [Y/n]?
如果选择继续,安装了php5和libapache2-mod-php5,则会导致buildix卸载,如果重新安装 buildix,安装过程中会出现下面的错误,原因大概是libapache-mod-php5被buildix自动卸载了。
liuzhr@suowan-master:/etc/apache2/sites-enabled$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2
* We failed to correctly shutdown apache, so we're now killing all running apache processes. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
apache2: Syntax error on line 183 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory。
原因应该是 buildix 依赖于 apache2-mpm-worker, 而目前的 php5只能运行单线程的apache2,这样就必须使用 apache2-mpm-prefork。
使用 apt-cache show buildix 一看,果然buildix依赖于 apache2-mpm-worker。看来必须放弃将 buildix与目前的 php5(Module方式) 在一起安装的方法。
于是只能选择使用 cgi 的方式来安装。参考这篇文章:Installing Apache2 and PHP5 using mod_fcgid 。配置的过程中发生了一些错误(you don’t have permission to access ‘/index.php’),似乎是因为下面的配置中,AllowOverride ,FCGIWrapper ,AddHandler 或者 Options +ExecCGI 的顺序导致的。没有时间仔细研究这个问题,高手看到请指教。
<directory>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
FCGIWrapper /usr/lib/cgi-bin/php5 .php
AddHandler fcgid-script .php
Options +ExecCGI
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</directory>
php5 目前不能使用 apache2-mpm-worker 模块是因为不支持多线程的apache2。 PHP如此说:Why shouldn’t I use Apache2 with a threaded MPM in a production environment?
有关 apt-get 的命令,参考这里:https://help.ubuntu.com/community/AptGet/Howto
有关 Ubuntu上的LAMP,参考:ApacheMySQLPHP
最近评论