Change PHP Versions in CyberPanel

Change PHP Versions in CyberPanel

Knowing how to change PHP versions for a website is important because a new version releases at least annually. However, sometimes you may need to use an older PHP version until one of your web applications releases an update to support the latest version. Other times you might just need to increase the system resources that can be used for certain PHP operations. Fortunately, CyberPanel allows you to configure different PHP configurations for separate websites.

Change PHP Versions for Websites

CyberPanel installs multiple PHP versions by default so you don’t need to install them manually. These steps will guide you through changing PHP versions for one website at a time.

  1. Log into CyberPanel.
  2. On the left, select Websites > List Websites.
  3. On the right-side of a domain, select Manage.
  4. Under Configurations, select Change PHP.
  5. Select a different PHP version from the drop-down menu and select the Change PHP button underneath it.

Install PHP Extensions

It is generally recommended to uninstall anything you don’t need on a system. Each PHP version comes with dozens of extensions installed by default. Here’s how to install and uninstall extensions for each PHP version.

  1. On the left, select PHP > Install Extensions.
  2. Select a PHP version from the drop-down menu.
  3. Select Install or Uninstall next to a PHP extension in the list.
    PHP extensions in CyberPanel
  4. Once the bottom of the progress window reads PHP Extension Installed or PHP Extension Removed, select Go Back.

How to Edit php.ini

Sometimes, having the correct PHP version for your website is not enough. Some applications require a higher allotment of memory for resource-intensive operations or file upload size for larger files to meet your demands. Below are two ways to configure PHP settings including memory limit, max execution time, and upload max file size.

  1. Select PHP > Edit PHP Configs.
  2. Select a PHP version from the drop-down menu.
  3. Make changes as needed.
    Edit php.ini in CyberPanel dashboard
  4. At the bottom, Save Changes.
  5. Restart PHP.

Advanced Editor

If you need to make more in-depth changes, you can edit the raw php.ini file in CyberPanel. This is helpful because not all options you might need will always be available in the admin dashboard.

  1. Select PHP > Edit PHP Configs.
  2. At the top, select Advanced.
  3. Select a PHP version from the drop-down menu.
  4. Edit the php.ini file in the text window.
    Edit php.ini file in CyberPanel
  5. Save Changes at the bottom.
  6. Restart PHP.

Check PHP Changes with phpinfo.php

The “phpinfo” PHP function generates a page listing information about a particular PHP version configuration on your system. Helpful info includes the full file path to the php.ini file and variations between server settings and a specific user’s custom settings for a PHP version.

The common usage is to name the file “phpinfo.php” but some bots search for this file as reconnaissance before cyber attacks. Therefore, below we recommend being creative with the filename. 

  1. From the dashboard, select Websites > List Websites > File Manager. Or, log into the CyberPanel VPS with FTP or SSH.
  2. Enter the public_html directory.
  3. Create a new file titled “phpcheck.php,” or something creative, and edit it.
  4. Add the following:
    <?php phpinfo(); ?>
  5. Save the file.
  6. Open the file in a web browser (e.g. example.com/phpcheck.php).
Create phpinfo Page

Learn more about how to manage your CyberPanel server.

If you don’t need cPanel, don't pay for it. Only pay for what you need with our Cloud VPS solutions.

check markCentOS, Debian, or Ubuntu check markNo bloatware check markSSH Key management made easy

J
Jacqueem Content Writer I

Technical writer focused on cybersecurity and musicianship.

More Articles by Jacqueem

Was this article helpful? Let us know!