Reputation: 1191
I ran the php server on cmd using php -S localhost:8080
, like this:
And I got this problem opening the localhost:
What do I supposed to do?
Upvotes: 27
Views: 108880
Reputation: 7199
You have to run that command in the folder/directory your site is in and you have to have a file names index.html
Upvotes: 1
Reputation: 11
You have to give the folder path after localhost:4000
as follows;
http://localhost:4000/folderName/index.php
If you made a special directory for PHP files or you can directly use root folder as the path
Upvotes: -1
Reputation: 1
Apart from adding filename after url, if you don't want to do this everytime, you can just specify the entrypoint to the application is your setting.json.
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "ABSOLUTE_PATH_TO_THE_PHP_FILE_YOU_WANT_TO_SERVE",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
Upvotes: 0
Reputation: 179
in my case, I named the file lesson.php
and had the same problem, but changing it to index.php
solved it! also as @prince mentioned adding the file name like this http://localhost:8080/filname.php
will solve it.
according to the manual in php.net
If a URI request does not specify a file, then either index.php or index.html in the given directory are returned. If neither file exists, the lookup for index.php and index.html will be continued in the parent directory and so on until one is found or the document root has been reached. If an index.php or index.html is found, it is returned and $_SERVER['PATH_INFO'] is set to the trailing part of the URI. Otherwise a 404 response code is returned.
Upvotes: 0
Reputation: 121
I got the same problem which occurred by running the php -S localhost:8002
in the wrong directory.
Project/src/
-> caused the error
Project/src/public
-> Solved
Upvotes: 7
Reputation: 56
I personally solved this error by putting my file name after http://0.0.0.0:3000/hello.php like this, you can see the results in the image above
Upvotes: 1
Reputation: 224
in rails, Missing
def index
end
in your controller.
if not, restart your computer and everything is fine
Upvotes: -1
Reputation: 364
This error also occurs when you have a path with the same name as a directory in the public folder:
Definition of path in the file routes.php
Route::get('Glaciares',function(){
return view('Principal.Glaciares.Acerca');
});
Public folder
Upvotes: 11