Linux Hosting (cPanel) Help

Set up multiple PHP versions for Linux Hosting

Set up different PHP versions (per directory or file extension) using your .htaccess file. This ensures compatibility with specific PHP features or requirements without altering your entire account.

Warning: This article covers an advanced technical topic where it's possible to make unwanted changes that GoDaddy cannot help you fix (see our Statement of Support). Before making changes, we strongly recommend downloading a backup.
  1. Go to your desired website directory using File Manager, FTP, or SSH.
  2. Note: This will affect subdirectories. For example, if you’re editing the .htaccess in /public_html, all the folders below will be affected.
  3. Edit the .htaccess file. If you don't have one, create a new file and name it .htaccess.
  4. In your .htaccess file, enter AddHandler, your desired PHP version and your desired file extension. In this example, we're using PHP 7.3 for files with the extension PHP. You can check the available software versions installed on Linux Hosting and change the example to your desired PHP version and extension.
    AddHandler application/x-httpd-alt-php73___lsphp .php
  5. (Optional) You can set multiple PHP versions and file extensions. For example:
    AddHandler application/x-httpd-alt-php56___lsphp .php5
    AddHandler application/x-httpd-alt-php70___lsphp .php70
    AddHandler application/x-httpd-alt-php71___lsphp .php71
    AddHandler application/x-httpd-alt-php72___lsphp .php72
    AddHandler application/x-httpd-alt-php73___lsphp .php73
  6. Save your .htaccess changes.

More info

Share this article