Loading...

Knowledge Base
 Up to 75% off  on  WordPress  hosting for WordPress Websites and Stores!

How To Configure the PHP Environment with PHP ini

The version of PHP helps keep your site secure, running efficiently, and compatible with any plugins. This article explains how to generate a new php.ini file if you are into changing the PHP version or made an error with your current php.ini file. Upgrading your PHP will automatically create the new php.ini file.


Update the PHP Version or Generate a New php.ini File

Important Note: PHP versions 7.3, 7.4, and 8.0 are no longer available on cPanel. We recommend updating to a supported version of PHP. The minimum PHP version on our Shared web hosting servers is currently at 8.1.

For more information on updating content for PHP compatibility, read our guide on What to do if your Site Does not Work with Newer Versions of PHP. To learn more about what is changing with PHP 8.3, please see PHP.net's release notes

  1. Log in to your Account Manager.
  2. Click Hosting on the left pane.

    Hosting tab

  3. Under Quick Links, click on cPanel.

    Quick Links - cPanel

  4. Within cpanel, look for the Software category and click the MultiPHP Manager icon.

    MultiPHP Manager

  5. Choose the domain you need to manage.

    Select domain to manage

  6. Select the PHP version from the PHP Version drop-down menu in the upper right.

    php-version-drop-down

  7. Click the Apply button to save the changes.

    php-version-apply

If you have any further questions about configuring the php.ini file, there are extensive descriptions within the file itself. You may also find more help at http://www.php.net/docs.php.

Add PHP handlers

You can customize the version of PHP that runs PHP files by directly editing the .htaccess file. Once the .htaccess file has been created or located:

  1. Navigate to the File Manager.
  2. Find the .htaccess file in the list of files, right-click on it, and choose the Edit option.

    File Manager - Edit

  3. At the top of the file, add the PHP handler corresponding to the version you desire to use. If there's an existing handler in the file, remove it or substitute it with your preferred handler.

    Below are the available PHP handlers:

    • PHP 7.4
       
      php – BEGIN cPanel-generated handler, do not edit 
      Set the “ea-php74” package as the default “PHP” programming language. 
      <IfModule mime_module> 
      AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml
      </IfModule> 
      php – END cPanel-generated handler, do not edit 
      
    • PHP 8.0
       
      php – BEGIN cPanel-generated handler, do not edit 
      Set the “ea-php80” package as the default “PHP” programming language. 
      <IfModule mime_module> 
      AddHandler application/x-httpd-ea-php80___lsphp .php .php8 .phtml 
      </IfModule> 
      php – END cPanel-generated handler, do not edit 
      
    • PHP 8.1
      php – BEGIN cPanel-generated handler, do not edit 
      Set the “ea-php81” package as the default “PHP” programming language. 
      <IfModule mime_module> 
      AddHandler application/x-httpd-ea-php81___lsphp .php .php8 .phtml
      </IfModule> 
      php – END cPanel-generated handler, do not edit 
      
    • PHP 8.2
      php – BEGIN cPanel-generated handler, do not edit 
      Set the “ea-php82” package as the default “PHP” programming language. 
      <IfModule mime_module> 
      AddHandler application/x-httpd-ea-php82___lsphp .php .php8 .phtml 
      </IfModule> 
      php – END cPanel-generated handler, do not edit 
      
    • PHP 8.3
      php – BEGIN cPanel-generated handler, do not edit 
      Set the “ea-php83” package as the default “PHP” programming language. 
      <IfModule mime_module> 
      AddHandler application/x-httpd-ea-php83___lsphp .php .php8 .phtml 
      </IfModule> 
      php – END cPanel-generated handler, do not edit 
      
  4. Once you have added one of those codes, click Save. The account will then use the PHP version you selected.

CGI Type

Below are options to consider when selecting the PHP type.

Standard PHP (Default)

By default, all accounts use standard PHP. A PHP script will use the server's master php.ini configuration file with standard PHP selected if the script's directory does not contain a php.ini file. Each hosting account initially has a copy of the php.ini file in the public_html directory. You may make any changes to this file, and the modification will take precedence over the master file. With standard PHP selected in the cPanel, you will need to copy the modified php.ini file into all subdirectories containing PHP files to use the custom PHP settings.

Different folders can have different php.ini files containing different PHP settings. If you need to use different PHP settings for two different scripts, you can place them in their own folder and with their own php.ini file.

PHP Single php.ini

To avoid copying the same php.ini file to each and every directory containing PHP files, you may select PHP Single php.ini. This option changes the PHP handler defined in ~/public_html/.htaccess to indicate that all subfolders use the same php.ini found in public_html/.

The .htaccess PHP handler is recursive through all subdirectories unless a subdirectory has a .htaccess file defining a PHP handler.

PHP FastCGI

Using the PHP FastCGI option allows all your PHP applications to run through mod_fcgid instead of mod_suphp. FastCGI uses only one php.ini file located in the public_html directory. 

Pro Tip: For information about configuring PHP for an addon domain, please see PHP Configuration for Addon Domain.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.

Did you find this article helpful?

 
* Your feedback is too short

Loading...