Control Panels

Optimizing PHP Performance in CloudLinux with PHP Selector

Learn how to enhance PHP performance on shared servers with CloudLinux’s powerful PHP Selector. Discover best practices for tuning PHP settings, managing versions, and optimizing server resources to improve speed and reliability for your websites.

Short answer: Each PHP version brings improvements in speed, features, and security. Running the right version ensures your website performs optimally while remaining secure and compatible with your web applications. With CloudLinux’s PHP Selector, you can choose and configure multiple PHP versions for different domains, giving you complete control over your hosting environment.

Why PHP Version Matters


PHP Versions in CloudLinux: From Legacy to Modern

CloudLinux supports a range of PHP versions, from legacy Alt-PHP to the latest PHP 8.4, allowing you to balance performance and compatibility for your applications. Here’s a detailed breakdown:

Alt-PHP Versions

Alt-PHP is a set of patched PHP versions maintained by CloudLinux to ensure security and compatibility for older applications. These versions are ideal for legacy websites that cannot be upgraded to newer PHP versions due to coding constraints.

  • Alt-PHP 5.6: Used for extremely old applications but no longer recommended due to limited support.
  • Alt-PHP 7.2: Offers better performance than 5.6 but lacks active security updates.
  • Alt-PHP 7.4: The last version in the PHP 7.x series, still widely used for older applications. Supported until November 2022.

When to Use: Alt-PHP is ideal for maintaining legacy sites while benefiting from CloudLinux’s security patches. However, upgrading to PHP 8.x is highly recommended for better performance and support.

PHP 7.x Series

PHP 7.x marked a major improvement in speed and resource efficiency compared to PHP 5.x. Although it’s now considered outdated, many websites still rely on PHP 7.4 for compatibility.

  • PHP 7.0–7.3: Faster than PHP 5.x but no longer supported. These versions should only be used for outdated applications that cannot be upgraded.
  • PHP 7.4: The most widely used version in the 7.x series, offering good performance and compatibility. Official support ended in November 2022, so upgrading is strongly advised.

When to Use: PHP 7.4 remains a practical choice for applications that haven’t yet migrated to PHP 8.x. However, it should only be used temporarily while transitioning to newer versions.

PHP 8.x Series

PHP 8.x introduced groundbreaking improvements in performance, security, and developer features. CloudLinux supports all PHP 8.x versions, including the newest PHP 8.4.

  • PHP 8.0: Introduced Just-In-Time (JIT) compilation for significant performance gains, especially for computationally heavy tasks.
  • PHP 8.1: Added new features like Enums, Fibers, and performance enhancements, making it a great choice for modern applications.
  • PHP 8.2: Improved type safety with readonly classes and other updates for cleaner code and better performance.
  • PHP 8.3: Focused on bug fixes and incremental improvements, making it more stable and secure for production environments.
  • PHP 8.4: The latest version, offering cutting-edge features and the highest level of performance and efficiency.

When to Use: PHP 8.x is the recommended choice for modern websites and applications. It provides enhanced speed, security, and support for newer frameworks like Laravel and Symfony.


How to Use PHP Selector in CloudLinux

CloudLinux’s PHP Selector makes it easy to switch between PHP versions and customize settings for each domain. Here’s how to get started:

1. Accessing PHP Selector

Log in to your cPanel account and navigate to the Select PHP Version option under the “Software” section. From here, you can manage PHP versions for your domains and subdomains.

2. Switching PHP Versions

Select the desired PHP version (e.g., Alt-PHP 7.4, PHP 8.1, or PHP 8.4) from the dropdown menu and click Set as Current. You can configure different versions for different domains as needed.

3. Enabling or Disabling PHP Extensions

Enable only the PHP extensions required by your applications, such as pdo_mysql, mbstring, or cURL. Disabling unused extensions helps optimize performance.

4. Adjusting PHP Directives

Fine-tune PHP settings to meet your application’s requirements:

  • memory_limit: Allocate enough memory for resource-intensive tasks (e.g., 256M).
  • max_execution_time: Prevent long-running scripts from timing out (e.g., 60 seconds).
  • upload_max_filesize: Set limits for file uploads (e.g., 128M).

Best Practices for PHP Optimization

Follow these tips to maximize PHP performance on shared servers:

  • Use OPcache: Enable OPcache to cache precompiled scripts, reducing execution times.
  • Monitor Resource Usage: Leverage CloudLinux’s resource monitoring tools to identify and address bottlenecks.
  • Upgrade Regularly: Keep PHP updated to the latest version supported by your application for better speed and security.

Why Choose UnderHost for CloudLinux Hosting?

At UnderHost, we offer fully optimized CloudLinux hosting environments with support for PHP versions from Alt-PHP to PHP 8.4. Here’s why our hosting stands out:

  • Flexibility: Easily switch between multiple PHP versions to suit your application’s needs.
  • High Performance: SSD-powered servers ensure lightning-fast page loads and efficient resource usage.
  • Enhanced Security: CageFS isolation and regular updates keep your applications secure.
  • 24/7 Expert Support: Our team is always available to help you configure and optimize your PHP settings.

Explore Our Hosting Plans and unlock the full potential of CloudLinux with PHP Selector today!

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

How do I change the PHP version for my site?

In cPanel, open Select PHP Version, choose the version and click Set as current. The change applies straight away.

Why does my PHP version change not take effect?

MultiPHP Manager can override PHP Selector. If the domain has its own version set there, ask support or set the domain to inherit the default.

Which PHP version should I choose?

The newest supported PHP version that your application supports. Check your application’s requirements, and test the site after switching.

Are old alt-php versions safe to use?

CloudLinux backports some security fixes, but old PHP versions also lack support from your applications and plugins. Use them only while you plan an upgrade.

How do I raise memory_limit or upload limits?

Open Select PHP Version, go to the Options tab, and change the value. Keep limits only as high as your site needs.