我怎样才能在Ubuntu上手动安装PHP5

我有一个新的VPN与Ubuntu服务器10.04 LTS随附的Mysql 5.1安装,这是不支持Barracuda文件格式,所以我手动安装和configurationMySQL 5.6。 到目前为止,这是完美的。

到目前为止,Apache2也运行良好(没有进行过很多testing,但似乎稳定)。

唯一的问题是PHP5不能识别PDO模块,所以我删除了它。

有没有办法,我可以手动安装PHP5或任何版本的PHP在Ubuntu上?

如果我做apt-get安装php5它说

root@vps:/etc# sudo apt-get install php5 Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: php5: Depends: libapache2-mod-php5 (>= 5.3.10-1ubuntu3.8) but it is not going to be installed or libapache2-mod-php5filter (>= 5.3.10-1ubuntu3.8) but it is not going to be installed or php5-cgi (>= 5.3.10-1ubuntu3.8) but it is not going to be installed or php5-fpm (>= 5.3.10-1ubuntu3.8) but it is not installable E: Broken packages 

你有没有尝试下载PHP源代码并编译?

获取源代码

 ./configure --prefix=... --extra options of your choice make make install INSTALL_ROOT=/where_to_install 

用Ubuntu包装它

修改httpd.conf

 LoadModule php5_module path/to/libphp5.so 

你可以使用一个ppa来保持与最新的PHP。 我用 :

https://launchpad.net/~ondrej/+archive/php5

它现在在5.5,并且还包括Apache 2.4更新。 对于Apache 2.2 + PHP 5.4版本库,请参阅答案的底部。

如果你想使用这个PPA做到这一点:

https://launchpad.net/~ondrej/+archive/php5 ( 点击这里查看说明)

 sudo add-apt-repository ppa:ondrej/php5 sudo apt-get update sudo apt-get upgrade 

如果您没有add-apt-repository二进制文件,请执行以下操作:

 sudo apt-get install python-software-properties 

注意事项:

PPA是否可以安全地添加到我的系统中,并注意哪些“红旗”?

对于Ubuntu 12.10,Ubuntu 12.10的官方存储库已更新为php 5.4。 如果可以的话,你应该使用主要的软件包包。 要做到这一点,只需安装php5安装php5而不启用任何PPA。

PHP 5.4预打包的最新PHP 5.4现在位于单独的PPA中: ppa:ondrej / php5-oldstable