Install old PHP version on Ubuntu

佐手、 提交于 2019-12-18 09:49:35

问题


I have got an Ubuntu14.04 and a PHP 5.5.9 installed.
Now I need PHP 5.4.*

As I have seen, it is not possible to downgrade it.
I have to purge it and then install the old version.

I have searched everywhere but I can't find an instruction how to get an old PHP version which works.

I already tried to get it with apt-get install php5=version, but apt-cache policy php5 does always only show PHP 5.5.9
And also
wget php5.4....
./configure
make
make install
doesn't work.

What is the solution for my problem?


回答1:


Download Apache http and PHP from source and it can be done.

Choose an installation source location; personally I use /usr/local/src but I've seen many alternatives.

Download Apache HTTP of the appropriate version (probably 2.4, I use the tar.gz files) http://httpd.apache.org/download.cgi

Download your PHP http://php.net/get/php-5.4.42.tar.gz/from/a/mirror

You will need to unzip (tar -zxvf), configure, make, make install both httpd and php. There are tons of configuration options you'll need to consider with both. You may hit many obstacles along the way and need to install various packages with apt-get but don't despair - search for the errors and you will find help, for example

Before you begin installing, make sure you've completely removed all remnants of php5.5

Good luck and post your results.




回答2:


Add this line to .htaccess to downgrade php version to 5.4

AddHandler x-mapp-php6 .php

for more details check this link https://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/php-c37728/manually-set-the-version-of-php-using-an-htaccess-file-a614325.html



来源:https://stackoverflow.com/questions/30982265/install-old-php-version-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!