phpgoogle-chrome

New version of Chrome broke chrome-php/chrome


I've been using HeadlessChromium in my PHP project on Ubuntu Server 23.10. Until recently, this worked to set up a new browser:

$browserFactory = new \HeadlessChromium\BrowserFactory();
$browser = $browserFactory->createBrowser
(
    [
        'windowSize' => [1024, 768],
        'debugLogger' => 'php://stderr',
    ]
);

Today I upgraded Chrome to version 128.0.6613.84

The above code started giving this error:

PHP message: RuntimeException: Chrome process stopped before startup completed. Additional info: mkdir: cannot create directory '/var/www/.local': Permission denied

So I created /var/www/.local and set its owner to www-data. Now I get this error:

PHP message: RuntimeException: Chrome process stopped before startup completed. Additional info: chrome_crashpad_handler: --database is required

I've tried adding a few more options to no avail:

$browser = $browserFactory->createBrowser
(
    [
        'windowSize' => [1024, 768],
        'debugLogger' => 'php://stderr',
        'args' =>
        [
            '--no-crashpad',
            '--disable-dev-shm-usage',
            '--disable-gpu',
            '--headless',
            '--disable-software-rasterizer',
            '--no-sandbox',
        ],
    ]
);

As far a I can tell the 'args' array has no effect.


Solution

  • The problem, as identified by @MartinZeitler is that there are directories missing from the www-data home directory. This solved the problem on my server (Ubuntu 23.10):

    sudo mkdir ~www-data/.local ~www-data/.config ~www-data/.cache ~www-data/.pki && sudo chown www-data:www-data ~www-data/.local ~www-data/.config ~www-data/.cache ~www-data/.pki
    

    In my case, the www-data home directory is /var/www