Beginner guide to update PHP in Joomla
How to fix errors when updating PHP is one of the most frequently asked questions in Joomla forums. It is a complicated job that beginners and professionals can struggle with. However, with proper guidance, you can avoid most of the errors and go through this job with ease.
With 5 minutes of your time, you can learn how to update PHP in your Joomla step by step.
Table of Content
What is PHP?
PHP is a popular general-purpose scripting language that is especially suited to web development.
In Joomla, PHP is the backbone language for developing the CMS. Joomla uses PHP but doesn’t install it. The installation comes from the hosting site, Joomla just uses PHP through their system. So any update or change needs to be made in the proper server environment.
Why do you need to update your PHP version?
Like any software, PHP needs constant updates and bug fixing. Also, with each new version of Joomla - and new extensions - the PHP requirement may change. So if you intend to keep your site up to date or use the newest features of a Joomla extension, you will have to update your PHP at the same time.
Updating PHP in Joomla: step by step
You need to follow these 3 simple steps:
- Step 1: Backup your data
- Step 2: Check PHP requirements for your Joomla site
- Joomla version
- Extension version
- Step 3: Update methods
Step 1: Backup your site
Updating PHP is a major change for your website, so before doing anything, you definitely need
to backup your data. If there are any errors after the update, you can revert to the prior backup version.
You can do this via Cpanel or through the Akeeba extension.
In this tutorial, we will use Akeeba as a backup method since it’s free, easy to use and effective.
- Download and install Akeeba backup to your site
- In the Akeeba control panel, choose Backup Now
- Once complete, click on Manage Backup to download for later reinstall if necessary
You can read more on how to fully backup your site and restore the backup file here.
Step 2: Define the PHP requirement for your Joomla Site
Check the compatibility of Joomla site and PHP version
At the time of writing this, PHP 7.3.14 was the latest version, and PHP 7.0+ was the most popular version. However, for some older Joomla versions like Joomla 2.5, updating to the latest version is not always a good idea as this version is not compatible with PHP 7.0+.
You can check this list to define your PHP requirement for your Joomla site.
- For Joomla 4 - Minimum version will be PHP 7.2
- For Joomla 3.x - Recommended version: PHP 7.3+ , minimum version: PHP 5.3.1*
- For Joomla 1.6, 1.7 and 2.5 - Recommended version: 5.6
- For Joomla 1.5 - Recommended version: 5.3
- For Joomla 3.0 through 3.2, the required version for PHP is 5.3.1
- For Joomla 3.3, the minimum PHP version is 5.3.10
- From Joomla 3.5 and later version, you should strictly use PHP 7.0+ only.
According to the latest research of Kinsta, each new PHP version performs better than the predecessors. So, it will be worth the time for you to update your current PHP to the latest version.
Also, with each new Joomla version, your PHP version might be made out of date.
So, an update for the PHP version should always be considered.
Check the compatibility of your extension and PHP version
Like Joomla, the compatibility of your Joomla extension and PHP also needs to be checked. If it’s outdated compared to your new PHP, you can update it via the Joomla Update system or install the latest package of the extension.
Step 3: update your PHP
Using one of the following methods, you can be able to update your PHP in Joomla.
Ask your hosting provider
This is the recommended way, and also the easiest way to update your PHP version. Any well-trusted provider will help you with this for free, and you can be assured that your site is in safe hands.
Update via Cpanel
Cpanel is a general term when talking about the control panel of any hosting provider. Some hosting providers like cloudaccess.net, Hostgator, and Bluehost have allowed you to update your PHP in a few simple steps.
Update via .htaccess file
If for some reason you can’t update your PHP file using the above two methods, then you can use the .htaccess file to get the job done. However, I would not recommend this method since the above two methods are the safest and the easiest ways to update PHP unless you are a professional in this area.
You can watch a detailed tutorial here:
Note: This tutorial shows you how to update from PHP 5.3 to 5.4, but the method is the same with any higher version.
Updating PHP should be handled by a professional. Your hosting site is the most reliable medium to use when conducting this task.