i am trying to capture a picture of a rendered site with Browsershot:
#[Route('/create-img-from-html', name:'create-img-from-html')]
public function createImageFromHTML()
{
Browsershot::url('https://localhost:8000/test')->save('playerImage.png');
...
}
#[Route('/test', name:'test')]
public function test()
{
return $this->render('img_temp/player_template.html.twig');
}
Problem is, that the built-in webserver seems to struggle with multiple simultaneous requests/processes, as described in this github post, even though thats laravel, but i think the problem might be the same.
The above works perfectly fine, if i switch the local url for something like ‘www.github.com’. It just doesn’t work with localhost-urls.
In the linked post, someone mentioned that you have to change the environment variable PHP_CLI_SERVER_WORKERS to something >1 to allow for multiple simultaneous processes/requests but i don’t know how to do that for the symfony webserver, because i dont use docker, like the people in the post, and i really dont find anything in the config that seems to be the right place to set this.
Can anyone help?
PS: I am using PHP 8.1 and Symfony 6.3, if that is relevant.
Lennart Bauer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.