0

I am having an issue testing a PHP-based REST API using PhpStorm. I am getting a file not found when doing the REST request using my localhost.

The call to the base file works as expected: http://localhost:61234/project/api/index.php The file is found, and I get back the result I expect.

I get a 404 file not found when I call http://localhost:61234/project/api/index.php/agent

That same path format works on my external server.

What configuration setting am I missing on the localhost so that it accepts a path formatted as http://localhost:123456/{{PATH}}/index.php/{MODULE_NAME}/{METHOD_NAME}?
EXAMPLE: http://localhost:123456/project/index.php/agent/1

Operating system: Windows 10
PhpStorm version: 2021.3.3
PHP version: 8.1

LazyOne
  • 158,824
  • 45
  • 388
  • 391
NealM
  • 58
  • 7
  • Is mixing double and single braces ok? – Markus Zeller Jul 29 '22 at 17:36
  • The double and single braces are just used here to illustrate the format. They are not part of the REST call. I added an example to better illustrate the format I am using. – NealM Jul 29 '22 at 17:37
  • 1
    The `http://localhost:61234/project/` part suggests that you are using PhpStorm's built-in *simple web server*. As I understand it simply does not handle the part after the real file name correctly (i.e. it assumes that the whole path must match the existing file). if that's the case (most likely IMO) then you have to use proper web server: e.g. your Apache/nginx .. or PHP's built-in web server... – LazyOne Jul 29 '22 at 18:20
  • I am using the PhpStorm built-in server. I expect it to be able to parse URLs correctly. Thanks for the help. – NealM Jul 29 '22 at 18:27

1 Answers1

0

Lazyone reply appears to be correct. The built-in server in PhpStorm does not parse the URL, the entire path must match.

NealM
  • 58
  • 7