在 Ubuntu 上安装 PHP 扩展


PHP extension installation on Ubuntu

我一直在尝试使用 sudo apt-get install php5-curl 安装 curl 扩展。但是不断收到以下错误消息

Err http://archive.ubuntu.com/ubuntu/ lucid-updates/main php5-curl 5.3.2-1ubuntu4.17
404  Not Found 
Err http://security.ubuntu.com/ubuntu/ lucid-security/main php5-curl 5.3.2-1ubuntu4.17
404  Not Found 
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/php5/php5-curl_5.3.2-1ubuntu4.17_amd64.deb  404  Not Found 
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

我尝试运行php -i | grep curl来检查curl是否已经安装但得到
-bash: php: 找不到命令

我想我必须安装 php5-cli 扩展,尝试这样做也导致了下面的错误

Err http://archive.ubuntu.com/ubuntu/ lucid-updates/main php5-cli 5.3.2-1ubuntu4.17
404  Not Found
Err http://security.ubuntu.com/ubuntu/ lucid-security/main php5-cli 5.3.2-1ubuntu4.17
404  Not Found 
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/php5/php5-cli_5.3.2-1ubuntu4.17_amd64.deb  404  Not Found 
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

你能ping security.ubuntu.com吗?

如果是这样,请尝试以下顺序:

sudo apt-get update --fix-missing
sudo apt-get update
sudo apt-get install php5 php5-cli