简体   繁体   English

安装curl extension php后停止工作

[英]After installing curl extension php stop working

on my working ubuntu 12.04 server i installed the curl extension for php with the commands: 在我的工作ubuntu 12.04服务器上,我使用以下命令为php安装了curl扩展:

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

after doing that php stop working 之后,该PHP停止工作
if I request some .php page, firefox attempts to download the file instead of running the script 如果我请求一些.php页面,firefox尝试下载文件而不是运行脚本

after some research i found that under the directory /etc/apache2/mods-enabled/ missing the links to the files: 经过一番研究后,我发现目录/etc/apache2/mods-enabled/缺少文件链接:

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

so I ran the command a2enmod php5 and links have been created 所以我运行了命令a2enmod php5并创建了链接
but when i lunch service apache2 restart it fails 但是当我午餐service apache2 restart时失败
under /var/log/apache2/error.log i found some lines like: /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

for various estensions. 适用于各种场合。
i've verified that the directory /usr/lib/php5/20100525/ doesn't exist anymore 我已验证目录/usr/lib/php5/20100525/不再存在
but i found the directory /usr/lib/php5/20121212/ that contains the .so files 但我发现目录/usr/lib/php5/20121212/包含.so文件

I also saw that the directory /etc/php5/conf.d is empty, there are no links, but all .ini files are under /etc/php5/mods-available 我还看到目录/etc/php5/conf.d为空,没有链接,但是所有.ini文件都在/etc/php5/mods-available

My questions are: why the update has created all these problems? 我的问题是:为什么更新会造成所有这些问题?
how can i fix that? 我该如何解决? the solutions can be change the reference from /usr/lib/php5/20100525/ to /usr/lib/php5/20121212/ ? 解决方案可以将引用从/usr/lib/php5/20100525/更改为/usr/lib/php5/20121212/吗? where i can do that? 我在哪里可以做到?

thanks for any help and sorry for my english 谢谢你的帮助,对不起我的英语

UPDATE 更新
I have created the link as suggested by seb 我已经按照seb的建议创建了链接

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

but when i restart apache it fails with error: 但是当我重新启动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

can a reinstallation of php solve the problem? 可以重新安装php解决问题吗? if yes how can i do that? 如果是,我该怎么做? thanks again 再次感谢

UPDATE 更新
after a few more unsuccessful attempt I restored the virtual machine from a snapshotand I solved the problem using aptitude. 经过几次不成功的尝试后,我从快照还原了虚拟机,并使用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

This first solution I answered No 我回答的第一个解决方案
The second proposed solution is 第二个建议的解决方案是

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

I accepted this second solution and the installation is successful, I only had to adjust the configurations of the virtual hosts for apache 2.4 我接受了第二个解决方案,安装成功,我只需要为apache 2.4调整虚拟主机的配置。

I dont now why it happened but you could just link /usr/lib/php5/20121212/ to /usr/lib/php5/20100525/ 我现在不知道为什么会这样,但是您可以将/ usr / lib / php5 / 20121212 /链接到/ usr / lib / php5 / 20100525 /

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

So you dont need to change all config files. 因此,您无需更改所有配置文件。

Update: 更新:

You can reinstall php with 您可以使用重新安装php

apt-get purge php5
apt-get install php5

I think a better package manager than apt-get is aptitude . 我认为aptitude是比apt-get更好的软件包管理器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM