I can see the phpinfo() information through http://localhost, but if I want to open it directly through the browser, the source code will be displayed.
PHP code must be implemented through the server. HTML can be opened directly like you do. PHP must be opened locally by entering localhost or 127.0.0.1 and the path/file name.
The path cannot be written like this in the environment 127.0.0.1 or localhost
Accessing the file directly through the browser will be treated as a text document, so the content of PHP will be displayed directly.
When accessed through the domain name, the result will be the content parsed by the PHP environment
PHP code must be implemented through the server. HTML can be opened directly like you do. PHP must be opened locally by entering localhost or 127.0.0.1 and the path/file name.