cretueusebiu / valet-windows

Laravel Valet for Windows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only seems to work with a single thread

tpavlek opened this issue · comments

After a pretty frustrating series of issues, I've settled on the problem that valet appears to only allow a single thread to execute at once.

You can replicate this by having two apps on your machine and just doing something like a sleep(20) in one of them, and then try to load the second. The second's request will not complete until the end of the sleep call on the first.

This is a dealbreaker for apps that need to communicate with each other because obviously an app in the process of responding to a request cannot make an http request to another app if both are blocked by the same thread.

I could not find anywhere to configure adding additional nginx/fpm threads. Ideas?

So a resolution to this is simply to set the PHP_FCGI_CHILDREN environment variable to something higher than one. The variable is respected on PHP versions 7.1 and higher.

I know nothing about windows services and I couldn't figure out how to set one with valet so I can't commit a pull here, but if anyone else is having a similar problem as a patch I simply stopped the valet_phpfpm service, and then set an environment variable in a console and ran C:\php\php-cgi.exe on port 9001.

Hopefully we can get a fix in this package!

@tpavlek You can add <env name="PHP_FCGI_CHILDREN" value="10"/> in ~/.config/valet/Services/phpfpmservice.xml and then run valet restart.

I'll add it by default.

Sorry to bring up an old issue but where would I find phpfpmservice.xml, its not in the valet-windows folder within composer.

@tomcrofty You can find it in ~/.config/valet/Services and it has been renamed to phpcgiservice.xml in the latest release.