Set up a LAMP environment to test PHP functions
. Create a new info.php file in the **/var/www/html/** directory.
Open info.php and enter the following code:
<?php
phpinfo();
?>
Open localhost/info.php in the browser and the following page appears
I tried various methods on Baidu and finally solved it by the following method:
cd to the /etc/apache2/mods-enabled directory
cd /etc/apache2/mods-enabled/
ls
Modify the dir.conf file
sudo nano dir.conf
The index.php positions transferred to the first
Next we need to restart the Apache web server.
systemctl restart apache2
Finally, reopen localhost/info.php in the browser and you are good to go!