How to let apache run index.php instead of index.html?

How to let apache run index.php instead of index.html?
0

#1

I want to run a php file on my local linux (ubuntu) machine.
I have already set up the LAMP stack. And now whenever I open localhost, i got this Apache2 ubuntu default page.

I have used sudo nano index.php to create a index.php file inside /var/www/html folder.
And I have set up dir.conf to this:

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

How do I run that php file then?


#2

I have found this answer on stackoverflow, but I don’t quite understand how should I execute it/
Could someone explain it to me?