如何在服务器中的 htaccess 中更改 php 版本

2022-08-30 09:19:21

我正在本地计算机上使用。在我们的网络服务器上,我们有.我们的服务器是共享服务器。所以我想通过文件更改我们服务器上的php版本。有可能做到吗?如果是,该怎么做?php 5.3php 4.8.htaccess


答案 1

要切换到 PHP 4.4::

AddHandler application/x-httpd-php4 .php

要切换到 PHP 5.0::

AddHandler application/x-httpd-php5 .php

要切换到 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:

AddHandler application/x-httpd-php7 .php

要切换到 PHP 7.1:

AddHandler application/x-httpd-php71 .php

答案 2

要切换到 PHP 4.4::

AddHandler application/x-httpd-php4 .php .php4 .php3

要切换到 PHP 5.0::

AddHandler application/x-httpd-php5 .php .php5 .php4 .php3

要切换到 PHP 5.1::

AddHandler application/x-httpd-php51 .php .php5 .php4 .php3

要切换到 PHP 5.2::

AddHandler application/x-httpd-php52 .php .php5 .php4 .php3

要切换到 PHP 5.3::

AddHandler application/x-httpd-php53 .php .php5 .php4 .php3

要切换到 PHP 5.4::

AddHandler application/x-httpd-php54 .php .php5 .php4 .php3

要切换到 PHP 5.5:

AddHandler application/x-httpd-php55 .php .php5 .php4 .php3

要切换到带有 Suhosin 补丁的安全 PHP 5.2,请执行以下操作:

AddHandler application/x-httpd-php52s .php .php5 .php4 .php3


推荐