Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cgi or Php Getting them both to work

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Anyone had this problem : If I add this :
<IfModule mod_php4.c>
AddType application/x-httpd-php .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps
</IfModule>
<IfModule mod_php3.c>
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps

My Cgi Scripts Quit working . And If i add </IfModule> at the end of my Php Quits Working and Cgi is working Fine again . Or if I take out the last half I get the same results ( No Php but Cgi Works ) .
I'm lost but still trying :>/
Thanks in advance !!!
 
In my case, I know that I have php4, so I placed those AddType defs right next to the .cgi def, no IfModule needed.
 
This is driving me bonkers , Please help ,
When I add this :
<IfModule mod_php4.c>
AddType application/x-httpd-php .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps
</IfModule>
<IfModule mod_php3.c>
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
---------------------------------
Php works fine but Cgi scripts wont work anymore , I've tried adding </IfModule> at the end of it , Cgi works then but Php wont . I've Tried just adding the AddType application's , Cgi works but Php wont again . like it is now only php works , i think ive tried every combo but the right one , but only one or the other will work at one time .
Please help and Thanks for your time !!!
 
Check the whole file to make sure every <IfModule> has a </IfModule> and there are no typos. This not how things are supposed to work. If you can't find the problem, try to use a fresh back up or you may have to reinstall. This file will be overwriten so change its name for reference later. Always make backups of files that you will be editing so you can get it back to where it was before it quit working. I don't know what else it could be but httpd.conf is in very bad shape and would have to be checked and rechecked line by line if you don't want to do another install.
 
Theres a </IfModule> at the bottom above ( finished indexing directory ) , When I remove it , php works but cgi dont , I dont see the other part of that ( <IfModule> ) anywhere . I've tried alot of combos , just dont know what to do now ???
Thanks All ...
 
Rak111, I will NEVER lie to you. :) The problem is in the IfModule condition pairs. Look at your httpd.conf while I explain this. Ready? OK. Go all the way down until you see the line that says <IfModule mod_mime.c>. It is saying if this condition is true (you have the mod_mime module installed) then do the following. This condition continues way down until AFTER all the AddHandler directives. There are nested IfModule conditions but each one gets closed but the <IfModule mod_php3.c> which is missing </IfModule>. When you take it out, <IfModule mod_php3.c> looks for the next </Ifmodule> that isn't in a closed pair (That is how nesting works), and it finds the one that should belong to <IfModule mod_mime.c>. This makes everything in between conditioned on if the mod_php3 is installed. This would include your Addhandler directives. If you have mod_php4 installed instead, then anything following <IfModule mod_php3.c> would not not meet the condition until it was closed. So how do I get them both to work, you ask? Put back the </IfModule> after the <IfModule mod_php3.c> becouse it MUST be there. This alone will not get your cgi-working again. But we need to move <IfModule Mod_mime.c>'s </IfModule> up so the AddHandler directives are not conditioned on it. They aren't anyway. Delete the </Ifmodule> in the line following all the AddHandler directives and move it up to just before <IfModule mod_php4.c> and see if it starts working. You will need to restsrt apache after you edit httpd.conf I hope I didn't confuse the daylights out of ya. Good luck.
 
:) . Thanks for such a detailed reply , I'll try it ! sounds like it should work and I really appreciate all your help !!!
Thanks again .
 
Another related question - is there any way to use server-side includes and php together?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top