1

在我工作的 ubuntu 12.04 服务器上,我使用以下命令安装了 php 的 curl 扩展:

apt-get install curl
apt-get install php5-curl
service apache2 restart

如果我请求一些 .php 页面,则在执行该 php 停止工作后
,firefox 会尝试下载文件而不是运行脚本

,经过一些研究后,我发现目录下/etc/apache2/mods-enabled/缺少文件的链接:

/etc/apache2/mods-available/php5.conf
/etc/apache2/mods-available/php5.load

所以我运行了命令a2enmod php5并创建了链接,
但是当我吃午饭时service apache2 restart它失败
了,/var/log/apache2/error.log我发现一些行如下:

PHP Warning: PHP Stratup: Unable to load dynamic library '/usr/lib/php5/20100525/pdo.so' - /usr/lib/php5/20100525/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0

对于各种 esttensions。
我已经验证该目录/usr/lib/php5/20100525/不再存在,
但我找到了/usr/lib/php5/20121212/包含 .so 文件

的目录我还看到该目录/etc/php5/conf.d是空的,没有链接,但所有 .ini 文件都在/etc/php5/mods-available

我的问题是:为什么更新会产生所有这些问题?
我该如何解决?解决方案可以将参考从更改/usr/lib/php5/20100525//usr/lib/php5/20121212/?我在哪里可以做到这一点?

感谢您的帮助,对不起我的英语

更新
我已经按照 seb 的建议创建了链接

ln -s /usr/lib/php5/20121212/ /usr/lib/php5/20100525

但是当我重新启动 apache 它失败并出现错误:

apache2: Syntax error on line 210 of /etc/apache/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

重新安装php可以解决问题吗?如果是的话,我该怎么做?再次感谢

经过几次不成功的尝试后更新
,我从快照中恢复了虚拟机,并使用 aptitude 解决了问题。

aptitude install php5-curl
The following NEW packages will be installed:
  libcurl3{a} libjson-c2{a} php5-curl php5-json{a} 
The following packages will be upgraded:
  php5-common 
1 packages upgraded, 4 newly installed, 0 to remove and 130 not upgraded.
Need to get 722 kB of archives. After unpacking 820 kB will be used.
The following packages have unmet dependencies:
 libapache2-mod-php5 : Dipende: php5-common (= 5.4.12-2~precise+1) but 5.5.3+dfsg 1+debphp.org~precise+2 is to be installed.
 php5-gd : Dipende: php5-common (= 5.4.12-2~precise+1) but 5.5.3+dfsg-1+debphp.org~precise+2 is to be installed.
 php5-mcrypt : Dipende: php5-common (= 5.4.12-2~precise+1) but 5.5.3+dfsg-1+debphp.org~precise+2 is to be installed.
 php5-mysql : Dipende: php5-common (= 5.4.12-2~precise+1) but 5.5.3+dfsg-1+debphp.org~precise+2 is to be installed.
 php5-cli : Dipende: php5-common (= 5.4.12-2~precise+1) but 5.5.3+dfsg-1+debphp.org~precise+2 is to be installed.
The following actions will resolve these dependencies:

     Remove the following packages:              
1)     libapache2-mod-php5                       
2)     php5                                      
3)     php5-cli                                  
4)     php5-gd                                   
5)     php5-mcrypt                               
6)     php5-mysql                                
7)     phpmyadmin                                

     Leave the following dependencies unresolved:
8)     libapache2-mod-php5 recommends php5-cli   


Accept this solution? [Y/n/q/?] n

第一个解决方案我回答否
第二个建议的解决方案是

The following actions will resolve these dependencies:
      Remove the following packages:
1)      apache2.2-bin 
2)      apache2.2-common 

      Install the following packages:
3)      apache2-bin [2.4.6-2~precise+1 (precise)] 
4)      apache2-data [2.4.6-2~precise+1 (precise)]
5)      libgd3 [2.1.0-2~precise+1 (precise)]
6)      liblua5.1-0 [5.1.4-12ubuntu1 (precise)]
7)      libtiff4 [3.9.5-2ubuntu1.5 (precise-security, precise-updates)]
8)      libvpx1 [1.0.0-1 (precise)]
9)      php5-readline [5.5.3+dfsg-1+debphp.org~precise+2 (precise)]

      Upgrade the following packages:
10)     apache2 [2.2.22-1ubuntu1.2 (now) -> 2.4.6-2~precise+1 (precise)]
11)     apache2-mpm-itk [2.2.22-1ubuntu1.2 (now) -> 2.4.6-2~precise+1 (precise)]
12)     libapache2-mod-php5 [5.4.12-2~precise+1 (now) -> 5.5.3+dfsg-1+debphp.org~precise+2 (precise)]
13)     libaprutil1 [1.3.12+dfsg-3 (now, precise) -> 1.5.2-1~precise+1 (precise)]
14)     libaprutil1-dbd-sqlite3 [1.3.12+dfsg-3 (now, precise) -> 1.5.2-1~precise+1 (precise)]
15)     libaprutil1-ldap [1.3.12+dfsg-3 (now, precise) -> 1.5.2-1~precise+1 (precise)]
16)     php5-cli [5.4.12-2~precise+1 (now) -> 5.5.3+dfsg-1+debphp.org~precise+2 (precise)]
17)     php5-gd [5.4.12-2~precise+1 (now) -> 5.5.3+dfsg-1+debphp.org~precise+2 (precise)]
18)     php5-mcrypt [5.4.12-2~precise+1 (now) -> 5.5.3+dfsg-1+debphp.org~precise+2 (precise)]
19)     php5-mysql [5.4.12-2~precise+1 (now) -> 5.5.3+dfsg-1+debphp.org~precise+2 (precise)]

Accept this solution? [Y/n/q/?] y

我接受了第二个解决方案并且安装成功,我只需要为 apache 2.4 调整虚拟主机的配置

4

1 回答 1

0

我现在不知道为什么会这样,但你可以将 /usr/lib/php5/20121212/ 链接到 /usr/lib/php5/20100525/

ln -s /usr/lib/php5/20121212/ /usr/lib/php5/20100525/

所以你不需要改变所有的配置文件。

更新:

你可以重新安装php

apt-get purge php5
apt-get install php5

我认为比apt-getis更好的包管理器aptitude

于 2013-08-30T15:29:16.043 回答