php4 and php5 not working together

deja_wu

Verified User
Joined
Jun 5, 2008
Messages
22
i have upgraded my php5.2.5 to php5.2.6 and i have a problem now:) i can't select php4 or php5 for each users.but before i have used with "AddHandler x-httpd-php4 .php" in user's .htaccess.i have checked my all config files but i don't found anything.user's is .htaccess file working i have checked but only AddHandler lines ineffective.i have rebuliled all (php4cgi-php5-cli or php5cgi-php4cli or php4 and php5 cgi) but i can't select now.. please help me because i will go mad :) thanks.
 
Did you run "./build phpX-cgi" and "./build phpX-cli" ? These commands don't touch configuration files, you need to run "./build php n".
 
yes i did run " ./build php n " but still AddHandler lines not working in .htaccess. now my options.conf default_php = 5, php4 cgi , php5 cgi,mail header patch and zend and apache is yes.but i can't select php version for each user.i use only default_php.i can change php.ini file path with " SuPhp_Config " but Addhandler not active ... :(
 
<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$"> line added in
/etc/httpd/conf/extra/httpd-php-handlers.conf file but not working :(
 
this is my /etc/httpd/conf/extra/httpd-suphp.conf

<IfModule mod_suphp.c>
<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$">
AddHandler x-httpd-php4 .php4
AddHandler x-httpd-php5 .inc .php .php3 .php5 .phtml
</FilesMatch>
<Location />
suPHP_Engine on
suPHP_ConfigPath /usr/local/etc/php5/cgi/
suPHP_AddHandler x-httpd-php4
suPHP_AddHandler x-httpd-php5
</Location>
</IfModule>


default php being php4 if i add .php after .php4
and normally www.domain.com/test.php4 is running php4 page and www.domain.com/test.php or test.php5 running on php5

AddHandler x-httpd-php4 .php line ineffective in /home/testuser/domains/domain.com/public_html/.htaccess

what can i do? for this line
 
you can put
<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$">
AddHandler x-httpd-php4 .php
</FilesMatch>

in your .htaccess then it will work
 
yes it is working now:) thank you very much but i can't understand.it worked before only with AddHandler x-httpd-php4 .php line interesting :) thanks
 
Yes it may work with this:

<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$">
AddHandler x-httpd-php5 .php
</FilesMatch>
or
<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$">
AddHandler x-httpd-php4 .php
</FilesMatch>

But who is going to answer our tech support lines when people using this:

AddHandler x-httpd-php5 .php .php5

are screaming at us because all of their scripts stopped working? Any takers to help out with free tech support? Didn't think so.

Yes I understand that using the FilesMatch is safer. Tried saying that in the beginning but nobody listened. There is a thing called doing your homework and looking ahead that avoids many headaches like this one.

Not directing this at you Jackc, just complaining in general. It has been a rough 48 hours.

BigWil
 
Last edited:
Hi all,

Does anyone have a clean solution for the following setup?
PHP4 CLI - Main
PHP5 CGI - For use with .htaccess or httpd.conf files (special per user if wanted)

I searched but there are no pointers as for the httpd config you need to have as well as suphp.conf configuration and the user config.

Thank you for your help..
 
CoMMy:
Code:
cd /usr/local/directadmin/custombuild

Edit options.conf file and set default_php=4, php4_cli=yes, php5_cgi=yes. Then run:
Code:
./build php n

Good luck!
 
Hi smtalk!

Yes, that is what i did, the default is php4 CLI which is what i want.

However how do i force php5 for a users virtualhost?

Thanks!
 
Back
Top