Answers:
我相信php5-curl软件包应该可以解决问题。请使用您选择的包裹管理器,并应妥善保管部门。
sudo apt-get install php5-curl
之后,您将需要重新启动服务器:
sudo service apache2 restart
另外,如果您使用的是php-fpm,则需要重新启动php5-fpm
sudo service php5-fpm restart
apt-cache search
顺便说一句。
对于php5.6子版本,请使用以下命令(已针对Ubuntu 14.04进行了测试):
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5.6
php — version
sudo apt-get install php5.6-curl
我的conf:Ubuntu 11.10,已经在终端安装php5-curl之前安装了mysql,php5和apache2,我这样做了:
编辑源列表,例如:
sudo -H gedit /etc/apt/sources.list
您可以在http://repogen.simplylinux.ch/中检查您的配置
下一条命令:
apt-get install aptitude
下一条命令:
aptitude install php5-curl
您得到的是这样的:
The following NEW packages will be installed:
php5-curl{b}
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 27.1 kB of archives. After unpacking 127 kB will be used.
The following packages have unmet dependencies:
php5-curl: Depends: php5-common (= 5.3.6-13ubuntu3.1) but 5.3.6-13ubuntu3.8 is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) php5-curl [Not Installed]
Accept this solution? [Y/n/q/?] n
您的答案是
接下来的行打印出来:
The following actions will resolve these dependencies:
Downgrade the following packages:
1) libapache2-mod-php5 [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]
2) php5 [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]
3) php5-cli [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]
4) php5-common [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]
5) php5-gd [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]
6) php5-mysql [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]
Accept this solution? [Y/n/q/?] y
您的答案是y。
在浏览器中打开phpinfo(),检查属性:
extension_dir /usr/lib/php5/20090626+lfs
在该文件夹中,您现在应该具有curl.so
编辑php.ini
nano /etc/php5/apache2/php.ini
在下面找到“动态扩展”添加代码:
extension=curl.so
重新启动apache2并检查phpinfo()之后,必须启用curl