i can't see index.php after installation of apache, php7 and phpmyadmin on debian 9, Why?

May 15, 2018 235 views
Deployment Debian

Hello, I'm getting mad to find how to make it works domain/index.php.

All component works well, PHP, apache2 is running, pahpmyadmin is ok.
I can read index.html and info.php, but index.php not. where i should change the config to read domain/index.php??

tahnk s a lot
Guiprix

3 Answers

In your site configuration for Apache in /etc/apache2/sites-enabled you need to make sure that index.php is listed as one of the files Apache will look for as an index (the file shown when you don't specify a filename).

DirectoryIndex index.html index.htm index.php welcome.html

This is an example. In this case if you had both an index.html and an index.php the index.html would be loaded and index.php ignored.

DirectoryIndex index.php index.html index.htm welcome.html

This list is used in the order listed so by placing index.php as the first option your index.php will now be shown instead of index.html

could you tell me which exact file I have to edit in /etc/apache2/sites-enabled/ ?

In the file : sudo nano /etc/apache2/sites-enabled/000-default.conf , in this file i don't have any <Directory > tag.

If i add under : DocumentRoot /var/www/html
the following:
<Directory />
DirectoryIndex index.php
</Directory>

index.php doesn't work. (HTTP error 500).

I found something similar of what you showed, in this file:
sudo nano /etc/apache2/mods-enabled/dir.conf , there i have the following:

<IfModule mod_dir.c>
DirectoryIndex index.php index.cgi index.pl index.html index.xhtml inde$
</IfModule>

i switch the 'index.php' at the beginning as suggested, but doesn't work either. And if I delete from this list 'index.html', the browser still show domain/index.html page correctly, so I presume it is not changed from here.

in my Filezilla i have:

/var/www/html

   index.html (working)
   index.php (not working)
   info.php (working)

can you tell me what to do? because I am lost.

thanks a lot

any suggestion? should i upload to server an .htacess file via ftp to have it working?

Have another answer? Share your knowledge.