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!

Download Box Poping up when using Php

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello , When I try to use , say a PHP Index page or any php page , a Download Box Pop's Up instead on the php ?
Any Thought's on why this would happen anyone ?
Thanks All in Advance !
 
Your server doesn't know how to handle this extension. Look in httpd.cong for these lines:

#
# These types cause httpd to let the PHP interpreter handle files with
# the specified extensions.
#
<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
</IfModule>
<IfModule mod_php.c>
AddType application/x-httpd-php .phtml
</IfModule>

You should also have this so apache can find your mime.types file:

<IfModule mod_mime.c>
TypesConfig /etc/mime.types
</IfModule>

Make sure .php is defined in /etc/mime.types with something like text/plain.

You may want to have an index.php one of these days so make sure you have this line:

#
<IfModule mod_dir.c>
DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php3 index.phtml index.cgi
</IfModule>

php scripts will run anywhere an html page will so you don't have to do anything special to the directory. If these don't work for you, it may mean that apache was compiled without the php modules or may just have to uncomment them. Good luck.

 
Thanks RhythmAce , One thing though , some of the php scripts are coming out as Strickly text , Can you help me with that ?
And as always , Thanks a Million !!!
 
Are you saying that some of them work correctly and others don't? Do any of them still try to pop up a download window? What changes did you make to httpd.conf? Editing mime.types was kind of a &quot;fall through&quot; measure. In the first section with the AddType directives, this told apache how to handle this type of file. If it failed &quot;IfModule&quot; tests then it would look in mime.types to see how to handle .php files. If you put text/plain php in there, apache would serve it as plain text, which seems to be what is happening. I have been assuming that you have only been editing the original version of httpd.conf but if you used a configuration program, it may have left a lot of stuff out. If you had to add the lines I posted earlier, then there is more missing. You will have to add and load some modules. If these lines do not exist, add them to you httpd.conf right under where all the modules are loaded and added near the top of the file.

#This section goes under the &quot;LoadModule&quot; section

<IfDefine HAVE_PERL>
LoadModule perl_module modules/libperl.so
</IfDefine>
<IfDefine HAVE_PHP>
LoadModule php_module modules/mod_php.so
</IfDefine>
<IfDefine HAVE_PHP3>
LoadModule php3_module modules/libphp3.so
</IfDefine>
<IfDefine HAVE_PHP4>
LoadModule php4_module modules/libphp4.so
</IfDefine>

#This section goes under the &quot;AddModule&quot; section

<IfDefine HAVE_PERL>
AddModule mod_perl.c
</IfDefine>
<IfDefine HAVE_PHP>
AddModule mod_php.c
</IfDefine>
<IfDefine HAVE_PHP3>
AddModule mod_php3.c
</IfDefine>
<IfDefine HAVE_PHP4>
AddModule mod_php4.c
</IfDefine>

If you defined php as text/plain in mime.types you can get rid of it now. If you have all the httpd.conf stuff I have in these 2 posts, you should not have to do anything else. It should work correctly.
 
RhythmAce , Once again I Own you , Thanks a Million !!!
I just hope all these Q's arent getting on your nerve's cause I might have one or two more soon :>)
Again Thanks Alot , I Really appreciate it !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top