4

What is the difference between x-httpd-php5x and application/x-httpd-php5x

I'v been using application/x-httpd-php for years with my web hosting (Linux) until they upgrade PHP to version>=5.2. Now I have to use x-httpd-php5x on web hosting which does not work on localhost (Windows).

So everytime I made some changes to the .htaccess, I have to change the AddHandler as well while uploading to web hosting.

Is there a cross-platform AddHandler to parse files as PHP?

edit

.php can always work, with/without specifing in .htaccess. but not custom extesions, e.g. .myphp

6
  • 1
    That's a directive that usually belongs to httpd.conf. Try taking it out of your .htaccess and see if your scripts will still be excuted. Setting that directive in .htaccess is usually done, when you don't have access to your server's config, which is mostly a case at some webhosting companies. Commented Oct 18, 2012 at 13:30
  • "What is the difference?" application/x-httpd-php is a valid internet media type, x-httpd-php5x isn't. Commented Oct 18, 2012 at 13:40
  • @feeela 5x = 52 or 53. but only x-httpd-php52 or x-httpd-php53 works on my web hosting. Commented Oct 18, 2012 at 13:43
  • 1
    Out of curiousity, why not use Linux as a development environment, and dual-boot between that and Windows? Alternatively, if you use something like git for version control, I think git-ftp by resmo allows for specific files to not be synched. That way, you could use the x-httpd-php5x on the server, but use application/x-httpd-php5x on localhost Commented Oct 18, 2012 at 13:48
  • @GlaciesofPacis ahha...I forgot to switch to linux...wait...do I have Linux installed? :) Thanks for the tip, but I'm not familar with Linux, and I believe there are a lot of people out there using a Linux hosting while developing on Windows locally. Commented Oct 18, 2012 at 13:55

1 Answer 1

2

The media type application/x-httpd-php5 was introduced specifically for PHP 5.0, application/x-httpd-php51 for PHP 5.1, application/x-httpd-php52 for PHP 5.2, etc...

In other words: the difference between them is to which version of PHP they are referring.

application/x-httpd-php is kind of obsolete, because it doesn't really refer to any version. This was fine in the early days of PHP, but as the number of versions grew, there was need for something more specific.
Most webhosts nowadays support multiple versions of PHP, and their webservers use the media types to pass the correct files to the correct PHP interpreters.

If your local development machine has PHP 5.1 or below installed, it's probably the reason why it doesn't support media types for PHP 5.2 and up.

A bit off-topic: If you have PHP 5.2 or below installed, I would advise you to upgrade to PHP 5.3 or up. At the time of this writing all versions below 5.3 are deprecated.

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

1 Comment

PS: If your webhost supports say x-httpd-php53 but not application/x-httpd-php53, they should fix this on their side.

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.