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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting apache to automatically recognise .php as base file 2

Status
Not open for further replies.

JavaSprout

Programmer
Jul 31, 2001
30
BE
Firstly, though I've been using Apache locally for over a year now, I'm new to Apache setting up, so easy with me!

I am looking to set up my own server, and want it to auto-magically load my first PHP page.

I have set up Apache 1.3.27 on my system with PHP (having first installed Apache 2.0 and then uninstalled Apache 2.0 when I found it is not compatible with PHP!).

I have set the DocumentRoot directive to point to my folder

DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/localpindev"

This works OK in that when I enter ' I get a list of my files. I can also click on my index.php file and it runs OK.

What I REALLY want to happen though is for the index file to automatically run.

Help!! :)

How do I set it to do this?

Thanks!
 
2 options:

1.) set it in your conf file (C:/Program Files/Apache Group/Apache/conf/httpd.conf)
2.) set it in an ".htaccess" file within the dir

syntax: DirectoryIndex index.php index.shtml index.htm index.html

Regards
David Byng
bd_logo.gif

davidbyng@hotmail.com
 
If you want it to be global (i.e. any directory) just add this to your httpd.conf

AddType application/x-httpd-php .php

make sure you have your Loadmodule for php as well and you can also make your index.php recognized as the default index by changing the line in httpd.conf like so:

DirectoryIndex index.html index.html.var index.php

and that should do it.
 
Yea I missed that one, but there is a version of PHP for apache 2.0 but it is still not recomended for production environments. I have been running it for a while now and I haven't had anything go awry though..
 
Sorry, but I fail to see where that page says that the two are not compatible. I am currently running Apache 2.0.45 with PHP 4.3.0 and it has been working flawlessly.

//Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top