2

I want to use php artisan serve as a Run Configuration in PhpStorm and already set it up like here.

When I run the command / configuration (?), the server seems to start but then is instantly stopped. This is my console output:

C:\dev\php\php_7.2\php-win.exe C:\Users\bendi\PhpstormProjects\dashboard\artisan serve
Laravel development server started: <http://127.0.0.1:8000>

Notice: Undefined index: REQUEST_URI in C:\Users\bendi\PhpstormProjects\dashboard\server.php on line 11
PHP Notice:  Undefined index: REQUEST_URI in C:\Users\bendi\PhpstormProjects\dashboard\server.php on line 11

Process finished with exit code 0

A simple php artisan serve in the console works normally.

EDIT: I think it isn't a duplicate because the problem hasn't anything to do with the php code (at least I think so). As stated earlier, the normal command works.

EDIT 2: my run configuration

TaskPlays
  • 31
  • 5
  • Can you describe in more detail how you've set-up your run configuration? When I follow the instructions in the linked question I can't reproduce this problem at all. – apokryfos Jun 05 '19 at 14:54
  • @apokryfos I just added a screenshot of my run configuration to my question. I don't think I did anything different to the linked question. – TaskPlays Jun 05 '19 at 15:48
  • 1
    Maybe there is something wrong with the Interpreter? In the linked question there is something about "If your php interpreter is setup correctly in your PHPStorm settings". – TaskPlays Jun 05 '19 at 15:49
  • 1
    `serve` uses the internal [PHP development server](https://www.php.net/manual/en/features.commandline.webserver.php) with `server.php` being the configured router file. If you instantly get the `REQUEST_URI` error then that indicates that something got short-circuited somwhere and is executing `server.php` on the CLI instead of when a request comes in. Not sure where that might be happening but that's my hypothesis in case it helps in investigating. – apokryfos Jun 05 '19 at 16:01
  • 1
    `C:\dev\php\php_7.2\php-win.exe ` .... --- please use **php.exe** instead of **php-win.exe** in your PHP Interpreter settings. – LazyOne Jun 05 '19 at 16:24
  • @LazyOne it works, thank you. – TaskPlays Jun 05 '19 at 17:05

1 Answers1

1

As @LazyOne pointed out, I simply had to change the CLI Interpreter in Languages & Frameworks > PHP > CLI Interpreter > PHP executable from php-win.exe to php.exe. Now everything works as wished.

TaskPlays
  • 31
  • 5