How to change my PHP version and PHP settings
Before changing PHP
A PHP version change can affect every PHP website using that account or domain.
Before continuing:
- Back up the website and database.
- Check which PHP versions your application supports.
- Update old plugins, themes or application code.
- Record the current PHP version.
- Make the change when you can test the website immediately.
Most Webway servers use CloudLinux's PHP selector. A few DirectAdmin servers do not have CloudLinux.
Change PHP in cPanel
- Sign in to cPanel.
- Open Software.
- Select Select PHP Version.
- Choose the required PHP version.
- Apply or save the change.
- Open your website and test it.
Change PHP in DirectAdmin
On a CloudLinux DirectAdmin server:
- Sign in to DirectAdmin.
- Open Extra Features → Select PHP version.
- Choose the required PHP version.
- Save the change.
- Test the website.
If the PHP selector is not available, open a support ticket. Webway can confirm which PHP versions and selection method are available on that server.
Which PHP version should I choose?
Use a PHP version that is:
- Supported by your website or framework
- Still receiving security updates
- Supported by all required plugins and themes
Do not select an old version only to hide an application error. Update the incompatible application where possible.
Change PHP settings
Open the PHP selector and then its Options or settings page.
Common settings include:
| Setting | Purpose |
|---|---|
memory_limit |
Maximum PHP memory available to one request |
upload_max_filesize |
Maximum size of one uploaded file |
post_max_size |
Maximum size of the complete submitted request |
max_execution_time |
Maximum time a PHP script may run |
max_input_vars |
Maximum number of submitted input variables |
Increase the upload limit
For larger uploads:
- Increase
upload_max_filesize. - Set
post_max_sizeto at least the same value. - Confirm that
memory_limitis suitable for the application. - Save the settings.
- Sign out and back in to the application if necessary.
- Try the upload again.
The lowest relevant limit controls whether the upload succeeds. Your application may also enforce its own limit.
PHP memory and account memory are different
memory_limit controls one PHP request. It does not increase the hosting account's total resources.
The default hosting-account limits are:
| Resource | Default limit |
|---|---|
| Memory | 2 GB |
| Entry processes | 30 |
| Processes | 90 |
Setting PHP's memory limit above the account's available memory does not give the account additional resources.
Test after changing PHP
Check:
- The home page
- The administration area
- Forms and uploads
- Checkout or payment pages
- Scheduled tasks
- Error logs
If the website fails immediately, restore the previous PHP version and review the error log.
Did this answer it?