Question

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

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


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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

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:

  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

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