在无头模式下使用时,puPHPeteer将永远占用

时间:2019-12-05 18:14:52

标签: php puppeteer

我已经安装了PHP bridge for puppeteer并尝试了示例代码:

use Nesk\Puphpeteer\Puppeteer;

$puppeteer = new Puppeteer;
$browser = $puppeteer->launch();

$page = $browser->newPage();
$page->goto('https://example.com');
$page->screenshot(['path' => 'example.png']);

$browser->close();

大约需要30秒(!),然后出现以下错误:

Fatal error: Uncaught Symfony\Component\Process\Exception\ProcessFailedException: The command "node "C:\xampp7.3.12\htdocs\puphpeteer\vendor\nesk\rialto\src/node-process/serve.js" C:\xampp7.3.12\htdocs\puphpeteer\vendor\nesk\puphpeteer\src\PuppeteerConnectionDelegate.js "{""idle_timeout"":60,""log_node_console"":false,""log_browser_console"":false}"" failed. Exit Code: 1(General error) Working directory: C:\xampp7.3.12\htdocs\test Output: ================ 50549 Error Output: ================ {"__rialto_error__":true,"message":"The idle timeout has been reached.","stack":"Error: The idle timeout has been reached.\n at Timeout.idleTimer.setTimeout [as _onTimeout] (C:\\xampp7.3.12\\htdocs\\puphpeteer\\vendor\\nesk\\rialto\\src\\node-process\\Server.js:68:23)\n at listOnTimeout (timers.js:324:15)\n at processTimers (timers.js:268:5)"}openssl config failed: error:02001002:system library:fopen:No such file or directory in C:\xampp7.3.12\htdocs\puphpeteer\vendor\nesk\rialto\src\ProcessSupervisor.php:309 in C:\xampp7.3.12\htdocs\puphpeteer\vendor\nesk\rialto\src\ProcessSupervisor.php on line 309

它超时并且找不到目录(?)

我正在使用最新的Xampp和php v7.3.12 + Node v11.0.0。在我的Windows10计算机上。

我将headless参数设置为false(如下所示),并且效果非常好:

$browser = $puppeteer->launch([
    'headless' => false
]);

引起此问题的任何想法?

0 个答案:

没有答案