Loading...

Knowledge Base
Up to 75% off on hosting for WordPress websites and online stores

How to Update PHP Version: Manage php.ini and PHP Handlers

Updating your PHP version is essential for keeping your website secure and running well with your website. This guide will teach you how to update your PHP version, create a new php.ini file, and manage PHP handlers. You'll also learn how to set up PHP FastCGI and the differences between available PHP versions. This will help your website run smoothly and efficiently.



Update PHP Version

Important Note: PHP versions 7.3, 7.4, and 8.0 are no longer available on cPanel. We highly 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.

To keep your website running smoothly, update the PHP version in your cPanel account: 

  1. Log in to your Bluehost Account Manager.
  2. Click the Hosting tab from the side navigation.
    Bluehost Dashboard highlighting 'Hosting' tab
  3. Under Quick Links in Server Information, click on CPANEL.
    Bluehost Dashboard highlighting 'CPANEL' button under Quick Links
  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 Apply 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 PHP versions that run PHP files by directly editing the .htaccess file. Once the .htaccess file has been created or located:

  1. Access 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.

Summary

Keeping your PHP version up to date is essential for maintaining the security and performance of your website. By learning how to generate a new php.ini file, configure PHP handlers, and effectively utilize PHP FastCGI, you can optimize your site for better functionality and compatibility. As you prepare to update your PHP version, be sure to support the latest versions of PHP, like PHP 8.1 and above, so your site will run correctly.

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...