cPanel & WHM

Optimizing PHP Performance in CloudLinux with PHP Selector: A Developer’s Guide

Unlock the full potential of your web applications by mastering CloudLinux PHP Selector. Learn how to customize PHP versions, extensions, and optimizers for maximum performance on shared and reseller hosting environments.

Short answer: PHP Selector on CloudLinux lets you choose a PHP version and extensions for each account. Pick a version your application supports, turn on OPcache, set sensible limits, and measure the page you care about before and after each change. The gains depend on your code and your traffic, so test rather than assume.

How PHP Selector works

On CloudLinux servers, the Select PHP Version tool in cPanel sets the PHP version and the extensions for the account. Each domain can run a different version, which lets an old application keep working while a new one uses a current version.

Choose the version

  • Check that your CMS, theme and plugins support the version before you switch.
  • Use the newest version that your applications support, and keep a note of the version you chose.
  • Test the site after each switch, including the admin area, forms and checkout.

Enable only the extensions you use

Each enabled extension adds code that PHP loads for every request. Turn on the extensions your site needs, such as mysqli, gd, intl and mbstring, and turn off the rest. Opcache should stay on for production sites.

Set sensible limits

Setting What it controls Advice
memory_limit Memory a single PHP process can use Set it high enough for your largest page, not higher
max_execution_time How long a request may run Keep it short for web requests; move long jobs to cron
upload_max_filesize Largest upload Match it to what the site really accepts
opcache.enable Caches compiled PHP code On for production

Measure before and after

Pick one page that matters, such as the product page or the login page. Measure its response time several times at the same time of day, using a tool such as curl or a load tester, then make one change and measure again. Keep the results in a simple table so you can see what helped.

# Time the response of one page, five times
for i in 1 2 3 4 5; do curl -o /dev/null -s -w "%{time_total}\n" https://example.com/; done

Caching and the database

A page cache removes most PHP work for visitors who are not logged in. Object caches such as Redis help dynamic sites. Database indexes and clean-up help too. See our Redis guide and our database guide.

Keep PHP updated

Security fixes for PHP come in new releases. Move to a supported version when your applications allow it, and read the release notes for the version you choose. Our PHP version support guide lists the supported branches.

Common problems after a change

Symptom Likely cause What to do
Blank page or 500 error A required extension is missing for that version Enable the extension, then check the error log
Warnings about a removed function The application uses an old function Update the application or plugin
Slower pages after enabling an extension The extension adds work on each request Disable it if you do not use it
Upload fails Upload limits are too low for the file Raise upload_max_filesize and post_max_size together

Application notes

WordPress, Joomla and other CMS platforms publish their supported PHP versions. Check the requirements of the version you plan to use, and test the plugins you depend on, because some older plugins are the last thing to be updated.

Set options per domain, not for the whole server

PHP Selector and MultiPHP settings apply to one domain or account at a time. Use that to keep an old application on its version while a new site runs a current one. Write down which domain uses which version, so the next change is not a guess.

Keep a change log

Record the date, the domain, the old and new PHP version, and the extensions you changed. When a problem appears a week later, the log shows what changed and lets you roll back to the previous setting quickly.

Measure the effect over time

One measurement shows a result for one day. Repeat the same page test each week for a month, at the same time of day, so that a traffic spike or a busy backup does not mislead you. Keep the numbers next to the change log, so each result has a reason.

Need help putting this into practice?

Our team can review your setup and help you choose the right plan. Contact @CustomerPanel for support.

View hosting plansContact @CustomerPanel

Frequently asked questions

What is PHP Selector?

A CloudLinux tool in cPanel that sets the PHP version and extensions for an account.

Will a newer PHP version always be faster?

Often, but not always. Measure your own pages before and after the change.

Should OPcache be on?

For production sites, yes. Check that it is enabled for the version you use.

Why does my site break after a version change?

An extension or a function may have been removed or changed. Check the error log, then enable the extension or update the code.