今天在 linux 14.04 上搭建 LAPM 环境,安装完 Apache2 之后,再去安装 PHP5,会出现如下错误:
[email protected]:/home/adu# apt-get install php5 libapache2-mod-php5
Reading package lists... Done
......
apache2_invoke: Enable module php5
Action ‘configtest‘ failed.
The Apache error log may have more information.
apache2_reload: Your configuration is broken. Not restarting Apache 2
Setting up php5 (5.5.9+dfsg-1ubuntu4.11) ...
此时去 restart Apache,会出现如下错误:
[email protected]:/home/adu# /etc/init.d/apache2 restart
* Restarting web
server
apache2
[fail]
* The apache2 configtest failed.
Output of config test was:
apache2:
Syntax error on line 140 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: symbol xmlOutputBufferGetSize,
version LIBXML2_2.9.0 not defined in file libxml2.so.2 with link time
reference
Action ‘configtest‘ failed.
The Apache error log may have more information.
以为是 libxml2.so.2 版本不对,跑去升级,还造成了其他错误。经过一下午的折腾和找资料,最后发现是由于 linux 版本混乱导致的。执行下面命令就可以了:
[email protected]:/usr/local/lib# rm /usr/local/lib/libxml2.so*
这期间还发生了一些其他错误,如
[email protected]:/usr/local/lib# sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
156 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up shared-mime-info (1.2-0ubuntu3) ...
update-mime-database.real: /usr/local/lib/libxml2.so.2: no version information available (required by update-mime-database.real)
Warning: program compiled against libxml 209 using older 207
也可以通过上述操作解决。