I use Visual Studio Code 1.96.4 where Live Server and PHP Server are two of my extensions.
I have PHP 8 installed locally on my computer (Windows 11) which I downloaded from php.
When I open an html page with Live server, there is no problem, however, when trying to open a php page, I get the message the page cannot be found
.
I have set localhost
to port 4000
and start it up via the command prompt, entering php -S localhost:4000
.
The following is my settings.json
file for Live server, by the way, the path to my php files is C:\Users\frank\www\
but when I use it in the settings.json
I get an invalid path
error.
{
"phpserver.port": 4000,
"phpserver.phpConfigPath": "C:\\php\\php.ini",
"phpserver.phpPath": "C:\\php\\php.exe",
"phpserver.browser": "google-chrome",
"liveServer.settings.host": "localhost",
"liveServer.settings.root": "/"
}
The PHP Server settings are as follows:
Browser : google-chrome
ip : localhost
PHP Config Path : C:\php\php.ini
PHP Path : C:\php\php.exe
Port : 4000
Relative Path : .
Router : Blank
When I type localhost:4000/www/index.php
, the site loads with no issue at all.
Have I got one (some) of the settings wrong in VSC or is there some mistake somewhere else?
I tried changing the setting for Live server and PHP Server, especially for the root, expecting VSC to find the root folder where the PHP files resides.