How to upgrade to PHP 8 to avoid bugs on your website?
As I write this article, PHP 7.4 is reaching the end of its lifecycle, so it will no longer receive security updates. It's time to update PHP, so here's a summary of how to try to prevent bugs on your website. I'll also describe the problems I've encountered on different hosting sites where joomla and wordpress websites and what was the solution. Sometimes the hosting provider updates the PHP and the website owners only get an error message on their website. For a 500 Error, try contacting the hosting provider to see if they can fix the problem. This article is more about avoiding errors, but there are 1-2 tips for 500 Error at the end of the article.
1. Compatibility check
First, check that the which PHP versions our software is compatible with. It is not that simple. Our smaller extensions are only checked for compatibility afterwards, so we may not be able to avoid the error messages mentioned in the title. Don't upgrade to the latest PHP version as I write this, PHP 7.4 to 8.0 is worthwhile. About wordpress compatibility find information here, while for joomla on this page inform us.
2. Save and update
Back up your website and update your WordPress or Joomla, template and plugins. Test your website after updates!
3. Erasing or logging errors
A Joomla admin interface in the Global configurations/Server/Error reporting : Maximum to erase the errors. A wordpress-and in the wp-config.php file to make the following changes:
// enable WP_DEBUG
define( 'WP_DEBUG', true );
// logging to /wp-content/debug.log
define( 'WP_DEBUG_LOG', true );
// don't write the errors to the website
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
It then writes the error messages to /wp-content/debug.log.
4. PHP version change

To change the PHP version, use the cpanel-can be done in. If only the MultiPHP Manager is available in cpanel, you have to configure the new PHP version there, then click MultiPHP ini editoryou may want to set some PHP directive values. For wordpress, I recommend at least this value: memory_limit=512M, post_max_size=32M, upload_max_size=32M. For Joomla, a smaller memory_limit=128M is sufficient. With the increased memory_limit we can avoid the following error:
Fatal error: Allowed memory size of 33445566 bytes exhausted
If only the Select PHP version is available in cpanel, you need to set the new PHP version there, and the PHP directive values above. Also here PHP extensions/modules can also be switched on if necessary. To ensure database connectivity, you may want to enable the PHP modules shown in the image below, but if you don't have mysqlnd, then mysqli-We are looking for. Wordpress still requires the imagick module to be switched on.

This will avoid the following types of error messages:
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in public_html/wp-includes/class-wpdb.php:1810
For other error messages, you may need to disable the wordpress or joomla extension to which the error message refers, because it may not be compatible with the new PHP version. To do this, you will need to revert to the previous version of PHP in the cpanel to access the WordPress or Joomla admin interface. It may also work to rename the directory of the faulty extension.
Finally, once you have eliminated all errors during the thorough tests, turn off the erasure or logging of errors. Reset the Joomla admin interface in the Global configurations/Server/Error reporting : None value, and in WordPress the define( 'WP_DEBUG', false); value in the wp-config.php file and delete the debug.log file!