Install php 7.4 for wordpress
With older PHP versions of 7.1 or older reaching end of life (EOL), and PHP 7.4 in full production, if you haven’t already its time that you install and configure PHP 7.4 and any required extensions, this article will walk you through the process of setting up PHP 7.4 on your Ubuntu based Nginx server, as well as installing the required and recommended PHP Extensions for WordPress website. Show PHP 7.4 offers security and performance improvements over previous versions. Although PHP 7.3 is still considered to be current, I also have a guide on setting this up – Click here for how to install PHP 7.3 instead In this article I am working on a system that was already configured and running PHP 7.3. Before you begin, the steps in this article assume the following
1. Add PPA repository and update package lists.Run the following commands to add the ppa:ondrej/php PPA repository to your system and update the available package list. This PPA contains the latest PHP packages and extensions for Ubuntu systems and is my recommended choice, even though there are a number of possible sources for these packages.
This should only take a minute to complete, after which you can install and configure the new PHP package and any required extensions. 2. Install PHP 7.3 and any extensions that you need.The next commands will install php 7.4 to your system and both the required and recommended extensions for running a WordPress website using the latest core branch. To install php-7.4 and php7.4-fpm;
To ensure that you have all of the required & recommended extensions for running WordPress websites (these extensions should also be sufficient for most other PHP based CMS platforms or functions), run the following;
A list of the required and recommended PHP extensions for WordPressWordPress have a published list of the required and recommended PHP extensions for running WordPress optimally in the WordPress Server Environment Documentation which is available in full by clicking here, but for your reference, below is the list as of November 11th 2020, with WordPress version 5.5.3 being the latest and PHP 7.4 being the recommended version. Many of them are included in the php7.4-common package, which is why they havent been explicitly added in the earlier commands. Required Extensions; curl – Performs remote request operations. Recommended Extensions;filter – Used for securely filtering user input. 3. Configure PHP 7.4 in your Nginx configuration.Next, you will need to update your sites Nginx configuration to utilize the recently installed PHP 7.4, if you already had an older php version installed and configured, this will just involve updating a little bit of code within your Nginx configuration. If you are using the default site block and only running a single site on the service, which would put your sites document root at
If you have multiple sites and configurations, and want to apply PHP 7.4 to them individually instead of adding it as the default, then edit the appropriate configuration file within the same directory as the “default” file, or if you are using a custom built site block, wherever your sites configuration may be set up. Once you have the file open using nano or your choice of text editor, next you need to add or amend the following code within the server configuration section to configure it for use with PHP 7.4.
Next you need to restart the php7.4-fpm service, as well as check the Nginx configuration for problems before restarting or reloading Nginx. The changes will not take affect until this is done. To restart php7.4-fpm – To check that the Nginx configuration changes have been made correctly – As long as the Nginx configuration test comes back as OK, then you can restart or reload Nginx using the following commands;
You can check the status of these service also by running the following command to make sure they successfully restarted on your server. After doing this, PHP 7.4 will be running any sites it was configured for;
How do I install PHP 7.4 on WordPress?Navigate to the Manage Domains page. Click the Edit link to the right of a domain. On the domain's settings page, look under the Web Options section for the PHP version: You should upgrade to 7.4 or 8.0.
Is PHP 7.4 Stable for WordPress?PHP 7.4. PHP version 7.4 is highly recommended by the official WordPress team. This version was released in Nov 2019 and over 28.7% of WordPress websites are running on it.
How do I install PHP version on WordPress?To update your WordPress site's PHP version, go to Sites and select the site you'd like to change the PHP version on. Then click on the Tools tab. Under PHP Engine click on the Modify button and select your preferred PHP version in the drop-down menu.
Does WordPress run on PHP 7?PHP 7 Hosting for WordPress
WordPress officially recommends that users to run their sites on PHP 7. This is because the WordPress core is always developed to run smoothly on the latest version of PHP.
|