Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

I have a server and host multiple clients websites there as vhosts. My Lamp-version is very outdated from 2008 and for a new project and want to have a newer one without changing my old websites, because they will break on update of the newer php-version. Is it posisible to configure a vhost on that system with another Lamp-version or a newer php-version?

System: Debian

Webserver: Apache 2

share|improve this question

marked as duplicate by Jenny D, kce, Tim Brigham, Ward, growse Jul 16 '13 at 9:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
This might be helpfull: it's an answer on askubuntu about running 2 versions of php I wrote a bit ago, the method used should be portable to debian: askubuntu.com/a/250187/11120 –  Nanne Jul 15 '13 at 12:13

1 Answer 1

You can't, since the PHP module handles the "application/x-httpd-php" mime type, and if you have two modules loaded, both of them would handle the same mime type. Probably the first to load wins. Module loading is done once upon staring the Apache instance, so you can't configure VirtualHosts to have an other module for PHP loaded.

You can do it with configuring your web server to use CGI, and running the PHP code as CGI script, you can have different interpreters for different type of PHP files. For this, you have to name the "CGI" PHP files to something else so that the original handler wouldn't recognize them.

However, you should really consider upgrading your server. A webserver from 2008 is a relic, and the PHP version you use probably has tons of bugs / security holes fixed long ago. If the old websites needs to be changed, so be it. This price for security doesn't seem too high.

share|improve this answer
    
not completely true: you don't need to rename the files, you can define a different handler in the vhosts settings I presume? –  Nanne Jul 15 '13 at 12:14
    
does it mean, it is possible or it is not? –  slaver113 Jul 15 '13 at 18:01
    
@Nanne: No, you can't do this, because you can't redefine the mapping already active for the x-httpd-php mime type. At least when I tried, Apache silently ignored the CGI mapping. slaver113: Theoretically it is possible. However, in my opinion, it is a pain to do this, not optimal, and prone to errors. Your best bet is to upgrade your server. –  Lacek Jul 16 '13 at 8:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.