Optimising PHP for WHMCS: The Best Version and Extensions in 2024

Web Hosting is an essential part of online business. Getting the right provider is important to factors like your search engine visability, internal company security and monthly sales conversions!

At GoodHost.com.au we have a few cPanel servers. They have cPanel, CloudLinux and more.

This article gives a good idea on how to set up the PHP and its extensions for the best performance.

To ensure WHMCS runs smoothly, it’s vital to configure PHP correctly with the right extensions and settings. This article details the optimal PHP version and extensions you’ve selected, organised alphabetically, for improved clarity.

1. Recommended PHP Version for WHMCS

For 2024, WHMCS officially supports PHP 8.1, which is the recommended version for optimal performance, enhanced security, and compatibility with modern modules. Older versions, such as PHP 7.x, are deprecated and should no longer be used.

2. PHP Extensions for WHMCS

Based on your current selections, these are the necessary PHP extensions for WHMCS, listed alphabetically for easier reference:

Core WHMCS Extensions

  • curl: Enables secure communication with external APIs, such as payment gateways and domain registrars.
  • iconv: Ensures proper character encoding, especially useful for multilingual setups.
  • json: Required for WHMCS APIs and many third-party integrations.
  • mbstring: Handles multibyte string operations for internationalised text support.
  • nd_mysql: An enhanced MySQL native driver for better performance and compatibility with WHMCS’s database.
  • nd_pdo_mysql: Optimised native PDO driver for MySQL, essential for database abstraction.
  • openssl: Secures encrypted communication with APIs and external services.
  • pdo: The PHP Data Objects extension required for database operations.
  • xml: Handles XML-based integrations, commonly used in WHMCS.
  • zip: Manages ZIP file operations, like compressing exports and reports.

Extensions for Enhanced Functionality

  • geoip: Provides IP-based geolocation, helping with fraud prevention and identifying client locations.
  • imagick: Supports advanced image manipulation for themes and custom modules.
  • opcache: Improves performance by caching precompiled PHP scripts, reducing server load.
  • redis: Enables caching functionality to boost performance when configured with WHMCS.
  • sockets: Supports modules or integrations that rely on socket communication.

Optional Extensions

  • bcmath: Improves mathematical precision for complex calculations, useful in financial modules.
  • exif: Handles metadata in image uploads, enabling customisations and advanced processing.
  • fileinfo: Accurately detects MIME types for file uploads.
  • intl: Enhances internationalisation features like formatting dates, times, and currencies.

3. PHP Options for WHMCS

Fine-tuning PHP settings ensures WHMCS operates efficiently. Here’s an overview of your configured options:

Recommended Settings

  • Memory Limit: 512M to handle large operations like backups and updates.
  • Execution Time: Both max_execution_time and max_input_time set to 600 seconds to prevent timeouts.
  • Upload Size: post_max_size and upload_max_filesize set to 64M, accommodating file uploads such as invoices or logos.
  • Input Variables: max_input_vars set to 5000 to avoid issues with large forms or configuration arrays.
  • Session Path: Correctly configured to /opt/alt/php81/var/lib/php/session, ensuring reliable session handling.

Error Handling

  • log_errors: Enabled for capturing and debugging errors.
  • display_errors: Disabled in production to avoid exposing sensitive information.

4. Steps to Configure in cPanel

Follow these steps to configure PHP for WHMCS in cPanel:

  1. Enable PHP Extensions:
    • Go to cPanel > PHP Selector > Extensions.
    • Select all the extensions listed above, including nd_mysql, nd_pdo_mysql, opcache, and redis.
  2. Adjust PHP Options:
    • Navigate to cPanel > PHP Selector > Options or MultiPHP INI Editor.
    • Update settings like memory limit, execution time, upload size, and input variables.
    • Also add something like this to the bottom of the file: date.timezone = “Australia/Sydney”

5. Verifying and Testing

After configuration:

  • Use WHMCS’s System Health Status to confirm all necessary extensions and settings are active.
  • Test key WHMCS functionalities, such as invoicing, email piping, and module integrations, to ensure everything works as expected.

6. Staying Updated

As PHP evolves, future versions like PHP 8.3 may become the preferred standard. Regularly update your PHP version and verify compatibility in a staging environment before applying changes to production.

Read more on the WHMCS website.

Leave a Reply

About Me

My name is Scott Nailon, I have been in the web industry since 2007(ish). I love technology and love to liberate people from the cowboys of my industry.

Recent Posts

Sign up for our Newsletter

Don’t worry, we won’t sell your email address or spam you!