Hello, I hope to install php7.4 but failed with some article which posted in last year or before…
the current default is 8.1 but still need 7.4 for old website…
Please help and big thanks in advance…
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there!
Installing PHP 7.4 on Ubuntu 22.04 can be tricky since it’s no longer included in the default repositories. However, you can still install it using the Ondřej Surý PPA, which maintains older PHP versions.
Here’s how you can do it step-by-step:
This repository contains all supported PHP versions:
Press Enter when prompted to confirm.
Once the PPA is added, refresh your package list:
Now, you can install PHP 7.4 and any required modules:
Replace or add modules as per your project’s requirements.
If multiple PHP versions are installed, you can set PHP 7.4 as the default:
Verify by checking the PHP version:
Don’t forget to restart your web server to apply the changes:
For Nginx:
For Apache:
One thing to keep in mind is that PHP 7.4 reached its end of life (EOL) on November 28, 2022, and no longer receives security updates. For production websites, consider upgrading to a supported version like PHP 8.1 or 8.2 if possible.
Let me know if you run into any issues!
- Bobby
Heya,
You just need to add the proper repo and you are good to go:
and now you are good to go. You can install php7.4 by using:
You can add as much php7.4-extensions as you like and need.