Change PHP version with Adding Handler in htaccess file

27 September 2017

The PHP handler is written into the .htaccess file. The .htaccess file is a hidden file that is read by the web server. The web server follows any instructions contained within the file. There are many ways to access this file. For the purposes of this article, we will explain accessing it through the File Manager on the cPanel of your hosting account.

 

  1. Open the File Manager located on the cpanel.
  2. On the directory selection popup, choose Web Root and select Show Hidden Files.
  3. Click Go
  4. In the table of files, you should see a file named .htaccess. Right click on the .htaccess file and select code edit.
  5. You may get a popup asking about encoding. If so, click the edit button.
  6. At the top of the file, insert the PHP handler for the version you would like to use. If there is a handler in the file already, it should be removed or replaced with your new handler.
  7. Note: See the Available PHP Handlers section for handlers on each of the php versions available. You can copy and paste these directly into the file.
  8. Click Save

Once you have saved the file, you can close it. Your account will then use the PHP version you selected.

Available PHP Handlers

The following handlers can be copied and pasted directly into your .htaccess file:

PHP 5.4

# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
PHP 5.4 Single php.ini

# Use PHP5.4 Single php.ini as default
AddHandler application/x-httpd-php54s .php
PHP 5.4 FastCGI

# Use PHP54CGI as default
AddHandler fcgid54-script .php
PHP 5.6

# Use PHP5.6 as default
AddHandler application/x-httpd-phpbeta .php
PHP 5.6 Single php.ini

# Use PHP5.6 Single php.ini as default
AddHandler application/x-httpd-phpbetas .php
PHP 5.6 FastCGI

# Use PHP54CGI as default
AddHandler fcgidbeta-script .php
PHP 7.0

# Use PHP7 as default
AddHandler application/x-httpd-php70 .php
PHP 7.0 Single php.ini

# Use PHP7 Single php.ini as default
AddHandler application/x-httpd-php70s .php
PHP 7.0 FastCGI

# Use PHP70CGI as default
AddHandler fcgid70-script .php


Sumber : Jasa Pembuatan Website, Siakad, Simpeg dan SIM Rumah Sakit https://klatenweb.com
Selengkapnya : http://klatenweb.com/read/2017/09/27/1198/Change-PHP-version-with-Adding-Handler-in-htaccess-file.html