I'm using PHP built in server like so:
$ composer serve
> php -S localhost:8000 -t public/
But it timed out..?
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "php -S localhost:8080 -t public/" exceeded the timeout of 300 seconds.
So, I tried to start it up again:
$ composer serve
> php -S localhost:8000 -t public/
[Thu May 26 21:31:51 2016] Failed to listen on localhost:8000 (reason: Address already in use)
Script php -S localhost:8000 -t public/ handling the serve event returned with error code 1
Why is the same port that the server was running on prior to timing out still in use? Can I stop all instances of PHP built in server?
If it matters, below is my composer.json file:
{
.
.
.
"scripts": {
"serve": "php -S localhost:8000 -t public/"
}
}
The problem is that composer has a default timeout after 300 seconds.
When executing the command you can use --timeout=0
, this disables the timeout. In your example the command would look like composer run-script server --timeout=0
you can set the process timeout in your composer.json
file like this :
{
...
"scripts": {
"start": "php -S 127.0.0.1:80 .router.php -t public"
},
"config": {
"process-timeout": 0
}
}
and start the web server like this :
$ composer start