开发者

htaccess and PHP handler

开发者 https://www.devze.com 2023-02-10 13:23 出处:网络
My shared hosting provider uses PHP 5.2.x. When I contacted them to ask why, and if 5.3.X was available, they said that they maintain 5.2.x so that client scripts don\'t break, but offer \"A handler f

My shared hosting provider uses PHP 5.2.x. When I contacted them to ask why, and if 5.3.X was available, they said that they maintain 5.2.x so that client scripts don't break, but offer "A handler for PHP 5.3 is added to our shared and reseller servers for those who wish to utilize it."

I was instructed to "add the following code to your .htaccess file:

Action applica开发者_高级运维tion/x-hg-php53 /cgi-sys/php53
AddType application/x-hg-php53 .php 

is it as simple as adding that to my site's root .htaccess file? And then everything will automatically use their 5.3 PHP instead of the default 5.2?


Yes, it is: These two lines instruct the server to associate any file ending with ".php" to call a specific program, namely php53.

Give it a try!

You could even write

AddType application/x-hg-php53 .php53

to make the "old" PHP execute *.php files, while your *.php53 files will be executed by PHP 5.3.x

The exact option depends on your hosting. For example this is the correct way to do it for 1&1:

AddType x-mapp-php5 .php


Yes, it should be. I have done this before, but to get an old site to use PHP4 because lots of things broke in PHP5 (it was an ancient site).

Once you add it to your .htaccess, you can confirm the version with echo PHP_VERSION or simply inspect the phpinfo().


The Action directive needs AllowOverride in the site configuration to include FileInfo. Otherwise you'll get Internal Server Errors.

Since this is shared hosting, and since they told you to do it, it probably is set up this way. If RewriteRule works, then it is set up this way.

0

精彩评论

暂无评论...
验证码 换一张
取 消