PHP (Hypertext Preprocessor) is the server-side programming language that powers the majority of websites on the internet, including WordPress, Joomla, Drupal, Magento, and countless custom applications. Choosing the right PHP version and configuring it correctly is essential for website performance, security, and compatibility. This guide explains how to manage PHP settings on your SakuraHost hosting account.

Why PHP Version Matters

Each PHP version introduces performance improvements, new features, and security fixes, while eventually deprecating older functions. Running an outdated PHP version exposes your site to security vulnerabilities and results in slower performance. According to official PHP supported versions, each release receives active support for 2 years and security fixes for 1 additional year.

PHP Version Performance Comparison

Version Status Speed vs 7.0 WordPress Compatible
PHP 7.4End of Life~1.5xYes
PHP 8.0End of Life~2xYes
PHP 8.1Security Only~2.2xYes
PHP 8.2Active Support~2.5xYes
PHP 8.3Active Support~3xYes
Recommendation: We recommend PHP 8.2 or 8.3 for all new websites. These versions offer the best performance and security. Only use older versions if your application specifically requires them.

Checking Your Current PHP Version

To see which PHP version your site is currently running, you can create a simple PHP info file:

Step 1: In cPanel File Manager, navigate to public_html and create a new file named phpinfo.php.
Step 2: Edit the file and add the following code:
<?php phpinfo(); ?>
Step 3: Visit https://yourdomain.co.tz/phpinfo.php in your browser. The page will display detailed PHP configuration information, including the version number.
Security Warning: Delete the phpinfo.php file immediately after checking your PHP version. This file exposes sensitive server configuration details that could be exploited by attackers.

Changing the PHP Version

Using MultiPHP Manager

Step 1: In cPanel, navigate to Software > MultiPHP Manager.
Step 2: You will see a list of your domains and subdomains with their current PHP version.
Step 3: Check the box next to the domain you want to modify.
Step 4: Select the desired PHP version from the dropdown menu at the top of the page.
Step 5: Click Apply. The change takes effect immediately.

You can set different PHP versions for each domain and subdomain on your account. This is useful if you run multiple websites with different compatibility requirements.

Configuring PHP Settings with MultiPHP INI Editor

Some applications require specific PHP settings to be adjusted. The MultiPHP INI Editor in cPanel allows you to modify these settings without SSH access.

Navigate to: Software > MultiPHP INI Editor in cPanel.

Basic Mode

The Basic Mode provides toggle switches and input fields for the most commonly modified settings:

  • upload_max_filesize: Maximum size for file uploads (default: 2M, recommended: 64M or higher for WordPress media uploads).
  • post_max_size: Maximum size of POST data. Should be equal to or greater than upload_max_filesize.
  • max_execution_time: Maximum time (in seconds) a script can run before being terminated (default: 30, recommended: 300 for heavy operations).
  • max_input_vars: Maximum number of input variables per request (default: 1000, increase to 5000 for complex WordPress sites with many plugins).
  • memory_limit: Maximum amount of memory a script can consume (default: 128M, recommended: 256M).

Editor Mode

The Editor Mode provides a raw text editor where you can add custom PHP directives. Select your domain from the dropdown, and add directives in the php.ini syntax:

upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300 max_input_vars = 5000 memory_limit = 256M

Using .user.ini for Per-Directory Configuration

For more granular control, you can create a .user.ini file in any directory. Settings in this file apply to that directory and all subdirectories. This is particularly useful for addon domains or subdirectories running different applications.

; /public_html/shop/.user.ini ; Specific settings for the e-commerce section upload_max_filesize = 128M post_max_size = 128M max_execution_time = 600 memory_limit = 512M

Troubleshooting PHP Issues

White Screen of Death (WSOD)

A blank white page usually indicates a fatal PHP error. Enable error display temporarily by adding this to your .user.ini or the top of your PHP script:

; In .user.ini display_errors = On error_reporting = E_ALL

Remember to disable error display on production sites after debugging. Check cPanel's Metrics > Errors for the error log, which provides detailed information about PHP errors without exposing them to visitors.

Compatibility Issues After Upgrading

If your website breaks after upgrading PHP, check for deprecated functions. Common issues include the mysql_* functions (removed in PHP 7.0+), which should be replaced with mysqli_* or PDO. The PHP migration guides document all breaking changes between versions.

If you need help selecting the right PHP version or resolving compatibility issues, contact SakuraHost support at billing.sakurahost.co.tz.

Was this answer helpful? 0 Users Found This Useful (0 Votes)