Change PHP Version in Control Web Panel (CWP)

Change PHP Version in Control Web Panel - PHP Version Switcher & PHP Selector

PHP is a popular programming language for dynamic site generation and integrating databases into web applications. Notable examples include the WordPress content management system (CMS), WHMCS billing system, PHP app hosting, and Nextcloud personal cloud storage solution.

This high popularity results in a frequent need to upgrade or simply change PHP versions. A new version of PHP is released more than annually to include security bug fixes and new features. However, which PHP version(s) you need in Control Web Panel (CWP) depends on the applications you need. Below we’ll cover how to change the primary PHP version and select a specific version for different user accounts.

Change PHP Version in CWP

Follow these steps to change the main PHP version in CWP. Generally, you should select the latest version. But if you have PHP applications installed, check the software documentation as you might be better off with the recommended version instead.

  1. Log into CWP as an administrator.
  2. On the left, search for and select PHP Version Switcher.
  3. Select a version from the drop-down menu.
    Control Web Panel PHP Version Switcher
  4. A list of available PHP modules will pop up below. The default options will suffice for most use cases. Unselected options you may need depending on software installed include ioncube (for WHMCS), mongodb, and redis.
    Install PHP extensions in Control Web Panel (CWP)
  5. After customizing your PHP build, select Save & Build at the bottom.

The page will refresh with a progress bar while compiling PHP in the background. This may take over thirty (30) minutes depending on your CWP server’s performance capabilities. You can select View log to check the PHP installation process. You can also find the same info from the CWP terminal with the following command:

tail -f /var/log/php-rebuild.log

Install Multiple PHP Versions

Administrators with a CWPpro license can install different PHP versions within CWP.

  1. On the left, select PHP Selector.
  2. Major PHP versions will be listed. To the right of each major is a drop-down menu to specify a minor PHP version to install and links to modify PHP options (extensions). Make a selection in every drop-down menu for major PHP versions you wish to install.
    Install multiple PHP versions in control Web Panel (CWPpro)
  3. Select Start Compiler (build & install).

Non-CWPpro users needing multiple PHP versions can try installing them from CWP terminal, but you’ll also have to manage it there.

Set Multiple PHP versions with PHP Selector

CWPpro end users can change PHP versions per domain. The process is pretty straightforward.

  1. On the left, select CWP Settings > Php Selector.
  2. Choose a domain from the drop-down menu.
    Choose a PHP version for a domain in Control Web Panel (CWPpro)
  3. Select from the available PHP versions.
  4. Select Update Version.

Manually Set Multiple PHP Versions 

Users not on a CWPpro server will still be able to see the PHP Selector. However, you won’t be able to make changes and there will be an alert stating “You need a CWPPRO license to use this module. Contact your server administrator.” 

We recommend Non-CWPpro users (on an Apache web server) ask your server administrator to install the PHP versions you need so that you can set multiple PHP versions in .htaccess. You can edit this file from File Management > File Manager. You can also do this in the command-line interface (CLI) if shell access is enabled for your user account.

Edit PHP.ini in CWP

Even with the correct PHP version you may need to make further changes for optimal PHP application performance. This section covers how to customize your PHP configuration file in CWP.

  1. On the left, select CWP Settings > Edit php.ini.
  2. Select a domain from the top if you have more than one under the account.
  3. Make changes as needed. The most commonly modified attributes are upload_max_filesize, memory_limit, and max_execution_time. Also, display_errors should be set to “Off,” unless you’re troubleshooting development issues.
    Control Web Panel php.ini editor
  4. Once you’re finished making changes, select Update changes on the right.
  5. (Optional) To add more custom changes, select Advanced Editor to edit the raw php.ini file.
    Advanced php.ini editor in Control Web Panel
    Select Save on the right once you’re done.

Create a PHPInfo.php File

To ensure your configuration works, you can create a phpinfo.php file. 

  1. From the user panel, select File Management > File Manager.
  2. Use the left-hand sidebar and navigate to the root directory for your website.
  3. At the top, select File, and type a PHP file name. “phpinfo.php” is a common name but it can be named anything with a “.php” extension.
  4. Click Save
  5. Select the third (edit) button under the “Actions” column for the new PHP file.
    Edit phpinfo.php in Control Web Panel (CWP) File Manager
  6. Add the following code block:
    <? phpinfo(); ?>
    Add PHP info code in Control Web Panel File Manager
  7. Click Save on the right.
  8. Visit the PHP info page in your browser.
Create phpinfo Page

Let us know if you have questions about configuring PHP on your CWP server.

Make sure your business, agency, or reseller clients are always connected and powered on with our optimized Managed VPS Hosting.
InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X