LAMP environment to build a blank page for PHP function testing

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

Insert picture description here
I tried various methods on Baidu and finally solved it by the following method:
Insert picture description here
cd to the /etc/apache2/mods-enabled directory

cd /etc/apache2/mods-enabled/
ls

Modify the dir.conf file

sudo nano dir.conf

Insert picture description here
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!
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44925547/article/details/106234034