PDA

View Full Version : [SOLVED] Apache - index.html is served instead of index.php



adit
December 27th, 2010, 11:45 AM
In the directory /var/www I have 2 files:
1) index.html
2) index.php
When I type http://localhost in firefox location bar, I get index.html. I want Apache to serve index.php. How to do that?

HugoSerrano
December 27th, 2010, 12:52 PM
humm... You may need libapache2-mod-php5 to enable that.
test it with http://localhost/index.php

If that works, you can add

DirectoryIndex index.php

in the file /etc/apache2/sites-enable/000-default
under the <Directory /var/www/>

ex:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
DirectoryIndex index.php
Order allow,deny
allow from all
</Directory>

adit
December 27th, 2010, 02:25 PM
My php installation is OK. The link http://localhost/index.php works.
I added the line DirectoryIndex index.php
in the file /etc/apache2/sites-enabled/000-default
under the <Directory /var/www/>
I restarted apache. Still it sends to the browser only index.html not index.php.

adit
December 27th, 2010, 02:43 PM
It works after rebooting entire operating system. Why it happens like this? Should I reboot ubuntu each time I edit any configuration file?

HugoSerrano
December 27th, 2010, 02:44 PM
rename or move the index.html

foltor
February 28th, 2012, 09:59 AM
Thank solved my problem

godzalli44
October 21st, 2012, 01:36 AM
humm... You may need libapache2-mod-php5 to enable that.
test it with http://localhost/index.php

If that works, you can add

DirectoryIndex index.php

in the file /etc/apache2/sites-enable/000-default
under the <Directory /var/www/>

ex:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
DirectoryIndex index.php
Order allow,deny
allow from all
</Directory>

wow thanx!!!. it works.

add DirectoryIndex index.php to <Directory /var/www/>
and "service apache2 restart"