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.

I have websites hosted on 1and1 and the servers default to PHP 4 and if you want PHP 5 or 6 you add "AddType x-mapp-php5(or 6) .php" and it'll run the scripts as PHP 5 or 6.

There isn't a lot of information out there about how such a system is setup, I've contact 1and1 support asking to talk to a tech but I've little hope they'll give me any info about how this work.

I have a ubuntu server in my basement running mysql/apache that I can use a dev box but half my apps are php4 and half are php5 currently the only way to work things is to uninstall one, and reinstall the other to get php4/5 use.

Does anyone have any idea how to setup "AddType x-mapp-php5 .php" capability so i don't have to keep uninstall/installing php over and over again?

share|improve this question

migrated from stackoverflow.com Feb 2 '11 at 1:57

This question came from our site for professional and enthusiast programmers.

2  
Not sure I understand. Is your question about where to put the AddType directive? –  Pekka 웃 Feb 1 '11 at 22:12
    
One is run through mod_php, the other(s) are run through CGI. Just Google it (here's one of many hits : howtoforge.com/apache2_with_php5_and_php4). BTW PHP6 hasn't even been released yet... I guess you can choose between PHP4, PHP5.2 and PHP5.3 –  wimvds Feb 1 '11 at 22:17
    
@wimvds Everything php4 has been removed from apt-get install, only php5 options available. As well: 1and1php.com/phpinfo.php6 PHP6(dev) running on 1and1 servers. –  iarp Feb 1 '11 at 22:48
    
@Pekka, this is a qestion about how to configure a server to be able to toggle between PHP4/5/6. The question was not about what to put in a .htaccess file but rather how to make the server provide the expected result from the contents of the file. –  Unkwntech Feb 1 '11 at 23:07
1  
@iarp: Ok, let me rephrase what I said : there's no stable release of PHP6 yet... I wouldn't install that on any production system, but hey, that's just me (and keeping my sanity :p). About php4 not being in the repo's : roll your own package or just compile from source (php.net/releases), it doesn't change anything about the apache configuration (which is what you're asking for right?). –  wimvds Feb 2 '11 at 8:46

2 Answers 2

You have two options:

  1. Run different apache instances on different ports (or IPs), which load different mod_php modules.
  2. Run the alternate versions as php-cgi (ie: php5 is mod_php, and the other versions run as php-cgi)
share|improve this answer

Last I checked, mod_php4 and mod_php5 didn't play nice together in the same apache, but maybe the hosting provider has figured that out. If so, then they likely have patched them to register as handlers for x-mapp-php5 or x-mapp-php4.

I wouldn't worry too much about this at all. You REALLY should be worried about PHP4 and the fact that it has been past its EOL for well over 18 months now!

http://news.php.net/php.announce/72

Do you trust the 1and1 guys to keep a version of PHP that is so badly out of date secure?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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