I want to upgrade the PHP version in my Ubuntu instance.

I run below commands.

$ sudo add-apt-repository ppa:ondrej/php

enter image description here

$ sudo apt-get update

enter image description here

Then I run;

$ sudo apt-get install php7.2.15

But it gaves me an error.

enter image description here

So I run below.

$ sudo apt-get install php7.2

enter image description here

Finally run below.

$ php -v

enter image description here

But it still shows as 7.2.13.

Any idea?


You can't get version 7.2.15 this way because the ppa does not provide this version. See here.

From a quick google search, I cannot find anybody providing the exact version prebuilt.

You can always get the exact version you want by compiling from source. This will take some skill and time. You will also need to manually swap the version apache or nginx is running with. You will need to restart your web server at the end.

You might find this article helpful - didn't try personally, and here is the link to the source code.

  • Thank you. Is there any way to get 7.2.15 instead of 7.2.19? – Thilina Nakkawita Jul 8 at 5:38
  • 1
    Do you have a good reason to use that particular version instead of a newer one? – Daniel Jul 8 at 13:33
  • I have a WordPress site. At the moment, it is running on 7.2.13. But I want to upgrade it to 7.2.15 as per a client requirement. – Thilina Nakkawita Jul 9 at 8:43
  • 1
    @ThilinaNakkawita That "client requirement" doesn't make sense. – Michael Hampton Jul 9 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.