Open jazz265 opened 3 months ago
Getting the same issue with Chrome >= 128 when A) running PHP for Windows in B) SAPI mode (e.g. Apache). In the logs, everything looks good (in my use case, I successfully invoke Page.printToPDF and see that DevTools logs "firstMeaningfulPaintCandidate"), except Chrome never writes a response to the web socket.
A workaround for me was disabling sandbox mode, e.g.:
$browserFactory->createBrowser(['headless' => true, 'noSandbox' => true]);
This may have security implications, depending on what you're using Chrome for; these can be mitigated by running Chrome inside a container.
Thank you for answering! I tried it, but it didn't work. Is there any other way?
In my environment, that error occurred when CPU resources were insufficient. I think too long time to process
Chrome was updated on our production server yesterday eve to 128.0.6613.85. Now, chrome-php times out. Running on Windows IIS with php 8.2.20; tested with php 8.3.10 with same results.
HeadlessChromium\Exception\OperationTimedOut: Operation timed out after 240s. in \chrome-php\chrome\src\Exception\OperationTimedOut.php:18 Stack trace:
Also experiencing this issue with Windows PHP 8.1 nts x64 and PHP 8.2 nts x64. Issue occurs using php-cgi.exe with IIS and php.exe from command line. Disabling sandbox mode has resolved the issue for now.
$browserFactory->createBrowser(['headless' => true, 'noSandbox' => true]);
PHP Fatal error: Uncaught HeadlessChromium\Exception\OperationTimedOut: Operation timed out (5sec) in C:\xampp\htdocs\x\sc\vendor\chrome-php\chrome\src\Utils.php:71 Stack trace:
0 C:\xampp\htdocs\x\sc\vendor\chrome-php\chrome\src\Communication\ResponseReader.php(115): HeadlessChromium\Utils::tryWithTimeout(5000000, Object(Generator))
1 C:\xampp\htdocs\x\sc\vendor\chrome-php\chrome\src\Communication\Connection.php(247): HeadlessChromium\Communication\ResponseReader->waitForResponse(5000)
2 C:\xampp\htdocs\x\sc\vendor\chrome-php\chrome\src\Browser.php(77): HeadlessChromium\Communication\Connection->sendMessageSync(Object(HeadlessChromium\Communication\Message))
3 C:\xampp\htdocs\x\sc\vendor\chrome-php\chrome\src\Browser\ProcessAwareBrowser.php(26): HeadlessChromium\Browser->__construct(Object(HeadlessChromium\Communication\Connection))
4 C:\xampp\htdocs\x\sc\vendor\chrome-php\chrome\src\Browser\BrowserProcess.php(157): HeadlessChromium\Browser\ProcessAwareBrowser->__construct(Object(HeadlessChromium\Communication\Connection), Object(HeadlessChromium\Browser\BrowserProcess))
5 C:\xampp\htdocs\x\sc\vendor\chrome-php\chrome\src\BrowserFactory.php(71): HeadlessChromium\Browser\BrowserProcess->start('C:\Program File...', Array)
6 C:\xampp\htdocs\x\sc\test2.php(16): HeadlessChromium\BrowserFactory->createBrowser(Array)
7 {main}
thrown in C:\xampp\htdocs\x\sc\vendor\chrome-php\chrome\src\Utils.php on line 71
The browser starts up, but it doesn't work and times out, closes, and gives the above error. Please let me know how to solve this.