Change PHP version on server using either .htaccess or php.ini

浪尽此生 提交于 2019-11-27 03:19:35

问题


How can I change the PHP version to 5.2 on a server using either an .htaccess of php.ini file?


回答1:


Adding

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

to your .htaccess might work.




回答2:


I take it you want to process e.g. .php3 files with php 3.x.

You can't switch between php versions like this, but you might be able to do it by setting up a proxy server that distributes the query to one of several servers (one for each PHP version).

There might also be some apache hack that works by calling the cgi-bin mode php in FastCGI mode. See the linked answer for this.




回答3:


According to https://www.first2host.co.uk/f/change-php-version-php-ini/, adding the following line to your php.ini file will change you to PHP version 5.2:

AddHandler application/x-httpd-php52 .php

It only works if your host is first2host though, I reckon.



来源:https://stackoverflow.com/questions/12105632/change-php-version-on-server-using-either-htaccess-or-php-ini

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!