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.
Composer ships with the composer-script process-timeout static helper to disable it, just add it on top of your script:
{
"scripts": {
"serve": [
"Composer\\Config::disableProcessTimeout",
"@php -S localhost:8000 -t public"
]
}
}
To test without changing the script, executing the command you can use --timeout=0
, this disables the timeout. In your example the command would look like composer run-script --timeout=0 serve
or prefix with the environment parameter like COMPOSER_PROCESS_TIMEOUT=0 composer serve
.
More information is also available in Why composer install timeouts after 300 seconds? on site.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With