I'm creating a website project using php through xampp. I've followed through a tutorial online and have opened up my website through localhost:8000. My question is, when I open a php file through command prompt, how do I specify which file I want to be opened? (at the moment index.php is the file that is opened). Screenshot below.
Files and command prompt screenshot
CodePudding user response:
To open a PHP file through the command prompt you type:
php nameOfFile.php
That isn't what you are doing. You're running the PHP built in web server. It doesn't open index.php, it starts a web server.
When you request a URL from that server from your browser (or other HTTP client) then it will map the path of that URL onto a file.
i.e. if you type http://localhost:8000/foo.php then it will run foo.php and return the result in the HTTP response.
If you request a directory, then it will try to map that onto a file called index.php in that directory.