9

I try to install php5 package with a specific version 5.4.

But I have problem and can not solve it myself. When I try to install :

"apt-get install php5=5.4.9-4ubuntu2" 

It returns me an error:

E: Version '5.4.9-4ubuntu2' for 'php5' was not found.

How can I solve this task?

2 Answers 2

36

Add this ppa

sudo add-apt-repository ppa:ondrej/php 

Then update and upgrade, upgrade will automatically install latest 5.4.x version of php

sudo apt-get update sudo apt-get upgrade 

Followed by,

sudo apt-get install -y php5.6

or

sudo apt-get install -y php7.2

depending on which version of PHP you want installed.


To install through Ubuntu software centre

php5 Install php5

(source: ubuntu.com)

Ref: https://askubuntu.com/questions/109404/how-do-i-install-latest-php-in-supported-ubuntu-versions-like-5-4-x-in-ubuntu-1

Sign up to request clarification or add additional context in comments.

7 Comments

I have found the answer here: launchpad.net/~ondrej/+archive/php5 to install 5.4 you have to load sudo add-apt-repository ppa:ondrej/php5-oldstable and sudo apt-get update and sudo apt-get upgrade. THANKS!!!
Use Igor Khromov ppa, but use this command for update: apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y
I have found thi other answer more complete in my opinion: stackoverflow.com/questions/13018626/…
I followed the instructions (and used php5-oldstable) and it still installs PHP 5.5. Any ideas...?
command sudo add-apt-repository ppa:ondrej/php5 produces error: Cannot access PPA (https://launchpad.net/api/1.0/~ondrej/+archive/php5) to get PPA information, please check your internet connection.
|
4

If anyone is still looking to install php 5.4 and wants to create a stand-alone install of php 5.4 from source, this is how do do it:

Create a folder named php-5.4 in your local home directory like ~/programs/php-5.4. Then execute below commands from it through CLI.

 sudo apt-get install gcc libmysqlclient-dev libxml2-dev wget --trust-server-names http://museum.php.net/php5/php-5.4.15.tar.bz2 tar xjf php-5.4.15.tar.bz2 cd php-5.4.15 ./configure --prefix=$PWD/installdir --enable-bcmath --with-mysql make install cd - 

Replace 5.4.15 with the latest old-stable version of php. Refer this Google appengine developer page for more details.

edit

Updated the new location for php 5.4.

6 Comments

wget responds with ERROR 404: Not found - seems the file is no longer hosted at the URL specified ..
@AndyLorenz Thanks for informing! Since PHP 5.4 has reached EOL, it is only available on museum.php.net now. I've updated the location in the answer accordingly.
that's great Prahlad, and thanks for updating your post. It would really help me (and possibly others reading this) if you could confirm how to "point" the server at this php version once its installed (at the moment my server doesn't even know its got a thing called php ...) many thanks
You can get the last minor version with curl http://museum.php.net/php5/ 2>/dev/null | grep ">php-5.4.*.tar.bz2" | cut -d'.' -f 3 | sort -g | tail -1
Whats then guys ? i did such php install and how i can connect apache and php 5.4 ? all articles are for standard php switch, not for meuseum php installs
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.