1

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 application/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?

7
  • 8
    Why don't you try it and see? Commented Feb 16, 2011 at 1:09
  • 2
    because I'd rather not bring down my site by accident because I was fumbling around with .htaccess without knowing a darn thing about .htaccess -- I have users to worry about besides myself! :-) Commented Feb 16, 2011 at 1:26
  • This will use CGI: it will start a new php53 process for each request. This is somewhat slower than mod_php. Commented Feb 16, 2011 at 1:28
  • 1
    If you worry about breaking stuff, you should test that your scripts work with PHP 5.3 first :) Commented Feb 16, 2011 at 1:29
  • 1
    @Andrew I wasn't suggesting you try it out on your live site. Setup a separate app under a new directory and try it out with a simple <?php echo phpversion() ?> Commented Feb 16, 2011 at 1:38

3 Answers 3

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

Sign up to request clarification or add additional context in comments.

Comments

2

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().

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.