Rumah > php教程 > php手册 > teks badan

How to install/setup latest version of PHP 5.5 on

WBOY
Lepaskan: 2016-06-06 20:13:04
asal
1071 orang telah melayarinya

Please note: This works fine. But this package will also upgrade your apache to version 2.4 which has different config files than apache 2.2 and even deletes stuff, like?/etc/apache2/sites-available/defaultwhen upgrading. This may result i

Please note: This works fine. But this package will also upgrade your apache to version 2.4 which has different config files than apache 2.2 and even deletes stuff, like?/etc/apache2/sites-available/defaultwhen upgrading. This may result in a loss of your apache settings (vhost, mod_rewrite stuff etc.). Be aware of that ! This shit cost me a full weekend. This affects only upgrades, not fresh installs for sure.?Update:?This is a known bug (more here), I’ll keep this post updated…

How to install

There’s an excellent and (usually) hassle-free method to install the latest version of PHP5 (which is 5.5.3 when i’m writing this) with 3 simple bash commands:

1. Add this package-repository to your system. If Ubuntu says that you need to download a key first, then follow the instructions given in the notice.

sudo add-apt-repository ppa:ondrej/php5
Salin selepas log masuk

If you get an error message now, then please do an update first and install the python-software-properties, that need to be necessary to add a package repository:

sudo apt-get update
sudo apt-get install python-software-properties
Salin selepas log masuk

2. Update

sudo apt-get update
Salin selepas log masuk

3. Install PHP

sudo apt-get install php5
Salin selepas log masuk
Salin selepas log masuk
更新过程中可能会出现The package openfire needs to be reinstalled, but I can't find an archive for it的错误。
Salin selepas log masuk
使用命令将openfire卸载掉:?dpkg --remove --force-remove-reinstreq openfire
Salin selepas log masuk

Check the installed version of PHP via

php5 -v
Salin selepas log masuk

Please note: The ondrej/php5 repository (which is used here) provides the very latest version of PHP. Usually the new version of PHP is available a few days after it was been officially released. This is really cool and a big step forward as Ubuntu, Debian, CentOS etc. provide only very old versions by default.

To UPDATE from PHP 5.3 / 5.4 to PHP 5.5:

It’s also possible to update from any PHP version to the latest one with exactly the commands above. But, after doing

sudo apt-get install php5
Salin selepas log masuk
Salin selepas log masuk

you’ll have to restart the server with

sudo /etc/init.d/apache2 restart
Salin selepas log masuk

or

sudo service apache2 restart
Salin selepas log masuk

By the way, I’ve also written a tutorial on “How to setup latest version of PHP 5.5 on Debian Wheezy 7.0/7.1/7.2 (and how to fix the GPG key error)“, which is different from this here.

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Cadangan popular
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan