我现在很困惑如何在不同的环境中将文件parsing为带有AddHandler PHP。
本地服务器 :
Windows 7 / Apache2.2 / PHP 5.2( thread safe )
AddHandler x-httpd-php .php # does not work AddHandler x-httpd-php52 .php # does not work AddHandler application/x-httpd-php .php # works
而我刚刚升级PHP到5.3(切换到non thread safe )
AddHandler x-httpd-php .php # does not work AddHandler x-httpd-php53 .php # does not work AddHandler application/x-httpd-php .php # does not work <-- works on 5.2 AddHandler php5-script .php # does not work # AddHandler... and I'v tried some of others, none of them works
虚拟主机
CentOS / Apache2.2 / PHP 5.3
AddHandler x-httpd-php .php # does not work AddHandler x-httpd-php53 .php # works AddHandler application/x-httpd-php .php # does not work (works prior to 5.2)
我的问题:
当我将PHP更新为5.3非线程安全的时候, AddHandler application/x-httpd-php .php如何在我的本地服务器上不起作用? 还有其他额外的工作吗?
什么时候应该使用x-httpd-php , application/x-httpd-php , php-script5和other types of format ? 这些OS / Apache版本/ PHP版本/ PHPtypes是否依赖?
好的,我要回答我自己的第一个问题
将PHP作为Apache模块运行
# httpd.conf PHPIniDir "C:/PHP" LoadModule php5_module "C:/PHP/php5apache2_2.dll" AddType application/x-httpd-php .php
将PHP作为CGI二进制运行
# httpd.conf ScriptAlias /PHP/ "C:/PHP/" Action application/x-httpd-php "/PHP/php-cgi.exe" AddType application/x-httpd-php .php <Directory "C:/PHP"> AllowOverride None Options None Order allow,deny Allow from all </Directory>
我还在等人解释第二个问题。