This post assumes that you’re running your app on PHP version 7.4 or earlier and you want to upgrade to PHP 8.0. Anytime you’re upgrading PHP you’ll want to make sure that the version you’re upgrading to is compatible with your apps. You’ll also want to take notes of all the PHP modules that are installed and running currently to support your projects. You’ll want to make sure that the current modules installed have corresponding versions with the latest PHP. When all the boxes are checked and you’re ready to migrate, follow the steps below to get it done. To get started, follow the steps below:
Find out installed PHP modules
Before you can upgrade, go and currently installed PHP modules. You’ll want to make sure you install the same modules for the latest PHP version. To find out currently installed PHP modules, run the commands below: That should list similar lines as below: Now that you know what PHP modules are installed, run go and do the same for the latest PHP version.
Install PHP 8.0
At the time of this writing, Ubuntu did not have PHP 8.0 packages available in its default repositories. To install PHP 8.0 on Ubuntu you may have to add third-party repositories and install from there. Simply run the commands below to add the below repository to Ubuntu. Then update and upgrade to PHP 8.0-FPM Next, run the commands below to install PHP 8.0-FPM and related modules. After installing PHP 8.0 and its modules, run the commands below to open to restarting PHP. PHP 8.0 is installed and ready to be used.
Use PHP 8.0 with Nginx
If you’re running an Nginx web server and you want to use PHP 8.0 use the steps below: Ubuntu default site configuration file can be found at Then edit the PHP block session: After that, restart the Nginx HTTP server to use PHP 8.0-FPM.
Use PHP 8.0 with Apache
To use PHP 8.0 with Apache instead, use the steps below: For Apache2 you’ll want to run the commands below along with the installed modules above. Then run the commands below to disable PHP 7.4 or the previous version installed. Now that PHP 7.4 is disabled, run the commands below to enable PHP 8.0. After enabling PHP 8.0, run the commands below to restart Apache2 and PHP 8.0 should be used to support WordPress. That’s it! Conclusion: This post showed you how to migrate your app to PHP 8.0 from a previous version. If you find any error above, please use the form below to report. You may also like the post below: