0
votes

So, ran into something very weird. Pretty new to Laravel.

Created a Laravel project and did some coding before running anything. I had previously created just a blank Laravel app and it was running just fine using all defaults. This was a second new project.

In the new project I can get Laravel running fine using php artisan serve --port=81 (non-default) but if I use just "php artisan serve" or "php artisan serve --port=8000" I get no response. Netstat shows no other processes using 8000, I've explicitly punched holes in Windows Firewall for that port and for php just in case. Nothing odd in hosts file. Not seeing anything that should be causing it.

There aren't any errors thrown when running php artisan serve, it comes up normally telling me it has started on port 8000. But whenever I try to access anything on that port it just doesn't respond. There's no "Whoops" message, it (Chrome or Postman) just sits there waiting for a response. Change it to port 81, 82, whatever, works as expected.

I have XAMPP installed though I'm not using it for Apache just now so Apache is turned off. Just for giggles I changed apache config to point at the public folder of that project on port 8000 and started it ... Worked fine; got the expected result from public/index.php.

Working with PHPStorm version 2017.2. I do have XDebug installed. Configured for port 9000. Not debugging via PHPStorm, just running artisan server.

PHP 7.1, Laravel 5.4, Windows 10

Any suggestions? I'm at a bit of a loss as I'm not seeing any errors anywhere and being rather new not sure where else to look/how to debug.

1
Do you need to use PHP Artisan to serve the webpage ? If you put your laravel install inside XAMPP and just point it to the project/public project it'll do the same thing. And if you've got port 80 configured on XAMPP Apache, even easier. - giolliano sulit
Sure I could use XAMPP. But I'm trying to understand a new ecosystem and just avoiding it rather than resolving it doesn't get me more understanding. It certainly wouldn't be a sufficient answer for production problems which I'll have to be able to resolve. :) - Fred
Well in that case, are you running the command with Administrator permissions ? That might be all you need to be able to use Port 8000, your command looks fine. I think it's Run Terminal/Command as administrator on windows? - giolliano sulit
I don't understand how elevation level would make a difference between running fine on port 81 and not doing so on port 8000 when everything else is the same. I'll give it a try later but I really don't expect that to make a difference. I'd be interested to know what makes you think that might help.. - Fred
I don't use windows, but it seems it's just an equivalent sudo permission error in linux. You don't have permission to open port 8000. Maybe check the windows system logs / events and see if that gives you an answer. - giolliano sulit

1 Answers

0
votes

Holy poopies.

Got it figured out.

As it turns out, when I added XDebug for PHP I fat fingered the default port for that to 8000 rather than 9000 in PHP.ini. It was then intercepting all the http requests on that port and swallowing them up it seems.

Everything pointed to some sort of configuration setting but when looking at settings in PHPStorm it still showed XDebug as set for port 9000. Since that's what I thought I entered in PHP.ini I assumed it was pulling it from there so I never looked at the ini file directly.