Is there a way to set a different PHP module per Virtual Host?

前端 未结 4 546
南方客
南方客 2021-02-04 14:51

I\'m developing for a bunch of sites on my local machine. Some of those sites ultimately run on php5.3, and some run on php5.2. Is there a way I can setup virtual hosts to use d

相关标签:
4条回答
  • 2021-02-04 15:32

    You should be able to manually compile both versions of PHP to separate directories and setup PHP with FastCGI for each website. FastCGI will give you comparible performance to mod_php on apache.

    You could also set each one up with CGI. Its a lot slower, but then you can't see how modules like APC will help your code or used shared memory or persistent connections reliable (they will work for just one request)

    If that doesn't work, you can make a second install of your webserver, configure it to run on a different port, and then set up your other webserver to act as a proxy, forwarding requests to a specific virtual host to the other webserver.

    0 讨论(0)
  • 2021-02-04 15:39

    I am use a denwer. It is a local server. Denwer can be installed many times on one machine or USB. I have 2 denwers on my computer. One with php 5.2. Second with php 5.3.

    0 讨论(0)
  • 2021-02-04 15:51

    Either you do as per the above and use different versions of PHP using FastCGI on your machine. But since it's for development, you could also use ie. VirtualBox or VMware server and create 2 virtual machines, one with PHP 5.2 and one with 5.3 (or you could create even more, one per project - that's how I would do it in fact :p).

    Possible benefits : you could use the OS - and the same software versions of ie. apache / mysql - that is used on your external host (that's why I would prefer one VM per project). This might also be beneficial when debugging later on.

    0 讨论(0)
  • 2021-02-04 15:55

    You could try to run php as cgi. I don't know if it works, you have to pass different php.ini locations to the cgi for things like different temp dirs. Wouldn't recommend it on a production machine.

    0 讨论(0)
提交回复
热议问题