Use the newest version your application says it supports, and never one that PHP itself no longer maintains. Here the version is chosen per folder in Select PHP Version, from 5.2 up to the 8.x line, and going back is just a different value in a menu. That makes testing cheaper than guessing.
An old version is not only “old”: it stops receiving security fixes, while newer ones tend to be faster and less forgiving of sloppy code. The right spot sits between what your application can take and what PHP still maintains.
How to choose, by situation
| Your situation |
What to do |
| A new site, or an application that gets updates |
The newest version the application’s documentation lists as supported. If it does not say, move up one version at a time. |
| An old application nobody updates |
The newest version it still runs on, once tested. And a plan to replace it: an ageing site with weak security. |
| Code you wrote years ago |
Try it in a test folder first. What usually breaks is in the red box below. |
| Two sites with different needs |
Each folder has its own version. There is no need for a compromise between the two. |
Changing it and checking, step by step
| 1 |
See what you run today. Select PHP Version (the Software section of cPanel) shows the account’s version. For one particular folder the safest proof is a file containing <?php phpinfo(); placed in that folder and deleted straight afterwards. The how-to is in viewing and adjusting your PHP configuration.
|
|
| 2 |
Find out what the application requires. It is in the application’s documentation, or in composer.json if you use Composer. Do not trust memory: requirements change from release to release.
|
|
| 4 |
Change one version and walk through the site. Home page, an inner page, the contact form, the login and one write to the database. This is where nearly everything shows up.
|
|
| 5 |
Read the error log. “Deprecated” notices are notes for the developer and stop nothing; fatal errors do stop. See where the PHP error log is.
|
|
| 6 |
If it failed, go back to the previous version. The site answers again at once, and you know exactly what is left to fix.
|
|
|
What usually breaks when you go up. Old code that calls functions that have since been removed (the mysql_* functions went in PHP 7; each() and create_function() in PHP 8), and extensions left switched off: every PHP version has its own set of enabled extensions, so something that worked on one version can be missing on the next. See switching a PHP extension on.
|
|
Jumping many versions at once is asking for trouble. Going up one at a time, walking the site between steps, shows which version broke what. The php.net site publishes the calendar of maintained versions.
|
|
Went up a version and now the site shows an error? Send us the text of the message and the address of the page.
Open a support ticket
|
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from $6.59/mo (3-year plan, with coupon) See plans |