In this article, we will guide you through the process of updating PHP from version 7.2 to 7.3 on an Ubuntu 18.04 server for WordPress. PHP is a server-side scripting language that is widely used in web development, including WordPress. Updating PHP can offer performance improvements, bug fixes, and new features.
To safely update PHP 7.2 to 7.3 on Ubuntu 18.04 for WordPress, you need to add the Ondřej Surý’s PHP repository, update the package list, install PHP 7.3, and verify the installation. Ensure compatibility with your WordPress site and plugins, and backup your site before proceeding. Test your site after the update and make any necessary adjustments.
Preparing for the Update
Before you begin the update process, it’s important to ensure that your WordPress site and any plugins you use are compatible with PHP 7.3. You can check this by visiting the WordPress and plugin developers’ websites or contacting them directly.
Also, don’t forget to backup your WordPress site. This is a crucial step in case anything goes wrong during the update process, you can easily restore your site to its previous state.
Updating PHP on Ubuntu 18.04
Step 1: Adding PHP Repository
First, open the terminal on your Ubuntu 18.04 server. We’re going to add a new PHP repository that is maintained by OndÅ™ej SurÃ½. To do this, run the following command:
sudo add-apt-repository ppa:ondrej/php
This command adds the OndÅ™ej SurÃ½’s PHP repository to your server’s list of repositories. This repository is well-maintained and contains the latest versions of PHP.
Step 2: Updating the Package List
Next, update the package list to include the newly added repository. This can be done by running the following command:
sudo apt update
This command updates the list of available packages from all your repositories, including the one we just added.
Step 3: Installing PHP 7.3
Now, install PHP 7.3 by running the following command:
sudo apt install php7.3
This command installs the latest version of PHP 7.3 available in the repository.
Step 4: Verifying the Installation
After the installation is complete, you can verify it by checking the PHP version. Run the following command to do this:
The output should display the updated PHP version, which should be 7.3.x.
After updating PHP, it’s important to test your WordPress site to ensure it’s functioning correctly. If you encounter any issues, you may need to update your WordPress theme or plugins, or in the worst case, downgrade PHP to the previous version.
Updating PHP on your Ubuntu 18.04 server for WordPress is a straightforward process that can provide numerous benefits. However, it’s crucial to ensure compatibility and take proper precautions such as backing up your site before proceeding. By following the steps outlined in this article, you can safely update PHP and keep your WordPress site running smoothly.
To check the compatibility of your WordPress site with PHP 7.3, you can visit the WordPress.org website and check the official documentation or contact the plugin and theme developers directly. They will provide information about compatibility with PHP 7.3.
To backup your WordPress site, you can use a backup plugin like UpdraftPlus or manually backup your files and database. Plugins like UpdraftPlus allow you to easily create a backup of your entire site, including files, database, and themes. Additionally, you can also manually backup your files by downloading them via FTP and exporting your database through phpMyAdmin.
Yes, it is possible to downgrade PHP to the previous version if you encounter compatibility issues after updating. However, it is recommended to first try to resolve the compatibility issues by updating your WordPress theme and plugins to their latest versions. If that doesn’t resolve the issues, you can downgrade PHP by following the same steps mentioned in this article, but installing the previous version of PHP instead.
While it is not mandatory to update PHP for your WordPress site, it is highly recommended. Updating PHP can bring performance improvements, bug fixes, and new features, which can enhance the security and functionality of your WordPress site. Additionally, running the latest PHP version ensures compatibility with the latest WordPress version and plugins, reducing the risk of vulnerabilities.