Change the PHP version and PHP limits on web hosting
Choose the PHP version per domain in cPanel or Plesk, enable extensions and raise memory_limit, upload_max_filesize and post_max_size within your plan's limits.
- Beginner
- 10 min read
- Updated
On this page
Each website on your hosting account can use its own PHP version and settings. This guide shows how to change the version, turn on extensions and adjust the most common limits, in cPanel (including the CloudLinux Select PHP Version tool some servers use) and Plesk.
Before you start
- Check which PHP versions your application supports (its system requirements page).
- Take a backup or make sure you can switch back: back up and restore your hosting account.
Step 1: Choose the PHP version
cPanel (MultiPHP Manager)
- Open MultiPHP Manager.
- Tick the checkbox of the domain.
- Choose the version in the PHP Version menu and select Apply.
Domains set to inherit use the server's default version.
cPanel (Select PHP Version)
On servers with CloudLinux, open Select PHP Version, choose the version from the menu and select Set as current. The same page lists the PHP extensions; tick the ones your application needs.
Plesk
- Open Websites & Domains and the domain's PHP settings (PHP Settings).
- Choose the PHP version from the list offered for your subscription.
- Select OK or Apply.
Verify: your site loads normally. If it shows errors right after the change, the application does not support that version: switch back.
Step 2: Adjust the common PHP limits
These PHP directives cause most upload and memory errors:
| Directive | What it limits |
|---|---|
memory_limit | The memory one script may use |
upload_max_filesize | The size of one uploaded file |
post_max_size | The size of a whole form submission; must be larger than upload_max_filesize |
max_execution_time | How long a script may run, in seconds |
cPanel
Open MultiPHP INI Editor, select the domain (or Home Directory for all sites), change the values in the basic editor and select Apply. The directives offered depend on the PHP version. On CloudLinux servers, the Select PHP Version page can also offer these options.
Plesk
In the domain's PHP Settings, change the values in the performance and security settings and select OK or Apply. Your subscription may allow only some of these settings.
Keep values sensible: very high limits hide problems and still stop at your plan's account limits.
Step 3: Check the result
Create a file info.php in the domain's folder with this content, open https://example.com/info.php, check the version and the values, then delete the file:
<?php phpinfo();Troubleshooting
The site shows a 500 error after changing the version. An extension the application needs is missing, or the code does not support the new version. Enable the extension or switch back; see hosting 500 and 403 errors.
WordPress says the uploaded file exceeds the maximum upload size. Raise upload_max_filesize and post_max_size as in Step 2.
Allowed memory size of … bytes exhausted. A script hit memory_limit. Raise it within your plan, or find the plugin or script that uses so much memory.
My change in .htaccess or php.ini has no effect. On many servers PHP settings are managed by the panel. Use the panel tools above.
Next steps
- Fix site errors: hosting 500 and 403 errors.
- WordPress-specific problems: fix WordPress errors.
Frequently asked questions
Which PHP version should I use?
The newest version your application supports. PHP lists on php.net which versions still receive security fixes; older versions are a security risk.
Can I use different PHP versions for different sites?
Yes. Both cPanel and Plesk set the version per domain.
Why can't I set memory_limit higher?
Your plan sets limits for each account. Values above them have no effect or are refused. If your application needs more, move to a larger plan or to a VPS.
How do I check which PHP version a site uses?
Put a file with phpinfo() in the site's folder, open it in the browser, then delete it right away, because it shows details about your setup.