How to Change the PHP Version for Your Website Print

  • 0


How to Change the PHP Version for Your Website

PHP is one of the most powerful programming languages today, widely used for developing web applications and websites. As an open-source language, it allows developers to modify and customize it to suit specific website needs, contributing to its widespread adoption. Major platforms like Facebook, the world’s largest social network, and Wikipedia, the largest online encyclopedia, are built using PHP.

You can update the PHP version to the latest one to ensure compatibility with your website and web applications. This can be done through the Qpanel or cPanel control panels, which provide a useful tool called PHP Selector. Alternatively, you can change the PHP version by editing the .htaccess file. This article provides a detailed, step-by-step guide with illustrative images on how to use these tools to update the PHP version.

Updating PHP Version Using PHP Selector

  1. Access Qpanel
    From the BayHost client area, log in to the Qpanel control panel. Under the SOFTWARE section, click on Select PHP Version, as shown in the image below.

     

  2. Choose the PHP Version
    A dropdown menu will display available PHP versions. Select the version compatible with your website and web applications. After choosing the desired version, click Save to apply the new version automatically.

     

Changing PHP Version via .htaccess File

  1. Log in to cPanel
    Access the cPanel control panel, navigate to the public_html directory, and enable hidden files by clicking Settings in the top-right corner. Check the box for Show Hidden Files.

     

  2. Edit the .htaccess File
    Locate the .htaccess file, open it, and add the appropriate code for the desired PHP version. For example:

    AddHandler application/x-httpd-php5 .php

    This sets the PHP version to 5.0. Use the following codes for other versions:

    • PHP 5.1: AddHandler application/x-httpd-php51 .php

    • PHP 5.2: AddHandler application/x-httpd-php52 .php

    • PHP 5.3: AddHandler application/x-httpd-php53 .php

    • PHP 5.4: AddHandler application/x-httpd-php54 .php

    • PHP 5.5: AddHandler application/x-httpd-php55 .php

    • PHP 5.6: AddHandler application/x-httpd-php56 .php

    • PHP 7.0: AddHandler application/x-httpd-php7 .php

    • PHP 7.1: AddHandler application/x-httpd-php71 .php

    • PHP 7.2: AddHandler application/x-httpd-php72 .php

    • PHP 7.3: AddHandler application/x-httpd-php73 .php

Additional Notes

  • You can change the PHP version anytime and revert to an older version using the same process.

  • We recommend using the latest PHP version, as it offers better support and improvements over older versions.

If you have any questions or need assistance, leave a comment, and the BayHost team will respond promptly.


Was this answer helpful?

« Back