Is it possible to run a different PHP in a given folder?

Asked

Viewed 1,223 times

4

I got a problem:

The server uses PHP 5.3, which is very old but cannot be changed. I have a script that requires PHP 5.4+, websocket Ratchet. It is possible to install a separate PHP to be used only in the folder where this script is located?

  • This might help: http://unix.stackexchange.com/questions/85543/compiling-php-and-installing-it-under-one-directory

  • Wouldn’t it be simpler to modify the code? or you use something that you can’t get around like 5.3?

  • There is no way around it. In this case it is the websocket Ratchet that did not work on the server because it is 5.3

  • 1

    Tell the question that the script is Ratchet can save your time ;)

  • Thanks, I changed there.

1 answer

2


You can install more than one version on the same server yes.

After installing the two versions of PHP, in the Apache configuration, on httpf.conf you can configure an extension for each version:

AddType application/x-httpd-php4 .php4
AddType application/x-httpd-php5 .php5
AddType application/x-httpd-php5 .php # the default

It is also possible to make an entire folder use a specific version by changing the .htaccess, in the folder you want to run in a different version by specifying the desired version.

AddType application/x-httpd-php4 .php

Source: https://serverfault.com/questions/85385/running-php4-and-php5-along-side-each-other

Browser other questions tagged

You are not signed in. Login or sign up in order to post.