0

I would like to install my PHP web application on a service that has two PHP versions, 4 and 5. I need PHP5, and I don't have access to httpd.conf due to server restrictions. How can I tell the Apache web server to choose PHP5 for this folder?

The server is Linux.

3

2 Answers 2

1

You can switch between your installed PHP versions in several ways. If you are restricted to use .htacess, you may add a handler in your .htacess file. For example if you want to use PHP 4, you can add the following code to your .htacess file:

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

For PHP 5.0 you can use:

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

For PHP 5.1 you can use:

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

Similarly for PHP 5.2 and 5.3. If you want PHP 5.2 with Suhosin patch use:

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

The answer can be found in the following links:

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

http://docs.1h.com/How_to_switch_PHP_versions

1
  • At the moment, this post is essentially only a link. To make sure the answer remains useful even if the link breaks, please edit it to include the relevant information. (Your answer was discovered in an effort to repair or remove old link-only answers.)
    – Ben N
    Jan 10, 2016 at 4:48
0

You can check this link:-

Try now:-

https://stackoverflow.com/questions/12561203/how-to-change-php-version-in-htaccess-in-server

http://kb.siteground.com/how_to_have_different_php__mysql_versions/

2
  • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.
    – DavidPostill
    Jan 21, 2015 at 11:52
  • At the moment, this post is essentially only a link. To make sure the answer remains useful even if the link breaks, please edit it to include the relevant information. (Your answer was discovered in an effort to repair or remove old link-only answers.)
    – Ben N
    Jan 10, 2016 at 4:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .