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:

  1. Back up the website and database.
  2. Check which PHP versions your application supports.
  3. Update old plugins, themes or application code.
  4. Record the current PHP version.
  5. 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

  1. Sign in to cPanel.
  2. Open Software.
  3. Select Select PHP Version.
  4. Choose the required PHP version.
  5. Apply or save the change.
  6. Open your website and test it.

Change PHP in DirectAdmin

On a CloudLinux DirectAdmin server:

  1. Sign in to DirectAdmin.
  2. Open Extra Features → Select PHP version.
  3. Choose the required PHP version.
  4. Save the change.
  5. 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:

  1. Increase upload_max_filesize.
  2. Set post_max_size to at least the same value.
  3. Confirm that memory_limit is suitable for the application.
  4. Save the settings.
  5. Sign out and back in to the application if necessary.
  6. 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?