Selecting PHP Version
cPanel allows you to select different PHP versions for your website. Newer versions offer better performance and security, but some applications may require specific versions.
Step 1: Log into cPanel
Access your cPanel control panel.
Step 2: Navigate to PHP Selector
Find the "Software" section and click "Select PHP Version" or "MultiPHP Manager".
Step 3: Select Your Domain
Choose the domain you want to configure from the list.
Step 4: Choose PHP Version
Select your desired PHP version from the dropdown menu and click "Apply".
Recommended PHP Versions
PHP 8.2 or 8.3
RecommendedLatest versions with best performance and security features.
PHP 8.1
Stable and widely supported by most applications.
PHP 7.4
Older but still supported by many legacy applications.
PHP 7.3 and below
End of life - Not recommended for production use.
WordPress Compatibility
WordPress officially supports PHP 7.4 and higher, but PHP 8.0+ is recommended for best performance. Check your theme and plugin compatibility before upgrading.
PHP Settings and Limits
You can adjust various PHP settings to optimize your website:
memory_limitMaximum amount of memory a script can use. Default is usually 128M or 256M. Increase for memory-intensive applications.
max_execution_timeMaximum time (in seconds) a script can run. Default is 30. Increase for long-running scripts like imports.
post_max_sizeMaximum size of POST data. Important for file uploads. Should be larger than upload_max_filesize.
upload_max_filesizeMaximum size of uploaded files. Default is often 2M. Increase for larger file uploads.
max_input_varsMaximum number of input variables. Increase if you see "max input vars exceeded" errors.
Modifying PHP Settings
Method 1: Via MultiPHP INI Editor (Easiest)
- In cPanel, go to "Software" → "MultiPHP INI Editor"
- Select your domain or use "Home Directory" for all domains
- Choose "Basic Mode" or "Editor Mode"
- In Basic Mode, adjust sliders for common settings
- In Editor Mode, add custom directives
- Click "Apply"
Method 2: Via php.ini File
Create or edit php.ini in your website's root directory:
memory_limit = 256M
max_execution_time = 300
post_max_size = 64M
upload_max_filesize = 64M
max_input_vars = 3000Method 3: Via .htaccess
Add to .htaccess file (only works with PHP as CGI/FastCGI):
php_value memory_limit 256M
php_value max_execution_time 300
php_value post_max_size 64M
php_value upload_max_filesize 64MMethod 4: Via wp-config.php (WordPress)
Add to wp-config.php before "That's all, stop editing!":
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');PHP Extensions
Enable or disable PHP extensions for your domain:
- Go to "Select PHP Version" in cPanel
- Click "Extensions" or switch to extensions tab
- Check/uncheck extensions as needed
- Click "Save"
Common Extensions:
mysqliMySQL database
gdImage processing
curlURL handling
zipZIP files
mbstringMultibyte strings
xmlXML processing
PHP Handlers
Different ways PHP can be executed on the server:
FastCGI
RecommendedBest performance and security. Each user's PHP processes run under their own username.
CGI
Basic CGI handler. Slower than FastCGI but widely compatible.
mod_php (DSO)
Runs as Apache module. Fast but less secure in shared environments.
Checking Current PHP Configuration
Create phpinfo() File
- Create a file named info.php in public_html
- Add the following code:
<?php phpinfo(); ?>- Visit yourdomain.com/info.php
- View complete PHP configuration
- Important: Delete this file after checking for security
Troubleshooting
500 Internal Server Error
- • Check PHP syntax errors
- • Verify .htaccess syntax
- • Check PHP error logs
- • Ensure PHP version compatibility
Memory Limit Exceeded
- • Increase memory_limit in php.ini
- • Optimize code to use less memory
- • Check for memory leaks
Upload Size Exceeded
- • Increase upload_max_filesize
- • Increase post_max_size
- • Ensure post_max_size is larger than upload_max_filesize
Best Practices
- • Use the latest stable PHP version when possible
- • Test PHP version changes in staging before production
- • Keep PHP settings minimal - only increase what you need
- • Monitor PHP error logs regularly
