PHP 7.4 is a new minor version of PHP with some breaking changes. While installing PHP 7.4 for my new website abhishekghosh.com I noticed that some packages do need careful installation. Overall our main guide on how to install PHP 7.2 on Ubuntu 18.04 LTS server should work fine for setup of a LAMP server for installation of PHP-MySQL web software like WordPress. The new features are written on the official website of PHP and also they have created a list of expected, known incompatibilities. You’ll notice there are changes with CURL and MySQLi. I noticed some issue with automatic update of a paid/premium WordPress plugin. Expect some unforeseen update issue with some paid/premium WordPress plugin/themes which still have not updated their PHP files. PHP 7.4 is intended to make PHP faster and more reliable. A handful of WordPress themes and plugins may not work until the respective developers update them. Very few WordPress plugins and themes actually can take the advantages of PHP 7.4 at this moment. So, it is practical to install or upgrade PHP to 7.4 in a dev environment.
We use Ondřej Surý’s PPA for PHP and Apache2. Run these commands :
1 2 3 4 5 6 | apt update -y apt upgrade -y sudo apt install -y software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt update -y apt upgrade -y |
Thereafter, you can install PHP 7.4 with all common extensions with a single command :
---
1 | sudo apt install php7.4 |
Or if you are sure what extensions required to be installed then run some command like :
1 | apt-get install php7.4-cli php7.4-fpm php7.4-bcmath php7.4-curl php7.4-gd php7.4-intl php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-sqlite3 php7.4-xml php7.4-zip |
After installation is complete, run php -v
to check the version. You can search modules for PHP 7.4 by running :
1 | sudo apt-cache search php* | grep 7.4 |
APCu makes codes faster by caching. Alternate method of installing APCu (example is for PHP 7.4) :
1 | sudo apt-get install php7.4-apcu |
Unlike before, it is working out of the box after installation.
The image used in this article is created by Zend.
Tagged With install php 7 4 ubuntu