ClioSport.net

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Apache webserver help

Car  Nike Lunar Elite's
I've got Apache running on my machine and I've got a really small problem which will probably be easy to fix but can't figure out how to do it.

My webpage works, and intergates correctly with php and mysql, but when I type in localhost it brings up the 'Index of /' list. I believe this is because I don't have an index.html, instead I have an index.php. How do I point to this as being my homepage? I'm geussing its something to do with the httpd.conf.

My page can be viewed here http://hydemp.dnsalias.com
 
Are you using linux ?

go to

/etc/conf.d

and edit php.conf, it should look something like this when your finished..


Code:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php4_module modules/libphp4.so

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddType application/x-httpd-php .php .bmp
# AddType application/x-httpd-php-source .phps

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php default.php index.htm
 
Oh and you will need to restart apache after the config change.. you can do this by issuing this command (as root)

Code:
/sbin/service httpd restart
 
Cheers KDF, I added index.php and it still wouldn't work. Its been ages since I've used Apache so I totally forgot that you have to restart it after making any changes. :D
 
No problem..

ye I dont think apache does a config file check at all unless restarted, services like samba do a recheck of the config file every so often so you dont have to restart it.. much better that way as it means you dont have to take the service down at all (if only for a second anyway)
 
Luckily this is just for a uni project, so down time really isn't an issue, just need to make sure its up and running whenever I meet with my tutor lol
 
Yep, you need to restart Apache to pick up any changes made to httpd.conf

If you're experimenting you can create a .htaccess file and put your stuff in there. It reads that for each request so takes immediate effect without a restart.

Wait until you get into mod_rewrite ;)
 
^^ It wont take a blind bit of notice of .htaccess stuff unless you have previously set it to allow overrides though.
 
Back
Top