You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering an issue where a PHP script using Browsershot functions properly when executed from the command line, but fails to work when accessed via a URL through a web server.
Error Output:
================
Error: Failed to launch the browser process!
chrome_crashpad_handler: --database is required
Try 'chrome_crashpad_handler --help' for more information.
[1789618:1789618:1115/163823.290253:ERROR:socket.cc(120)] recvmsg: Connection reset by peer (104)
Php:
<?php
require 'vendor/autoload.php';
use Spatie\Browsershot\Browsershot;
Browsershot::url('https://example.com')
->setChromePath('/usr/bin/google-chrome')
->addChromiumArguments([
'no-sandbox',
'disable-dev-shm-usage',
'disable-gpu',
'disable-software-rasterizer',
'disable-crashpad',
'no-crashpad',
'disable-crash-reporter',
'headless'
])
->save('example.png');
echo "Screenshot has been saved as example.png";
?>
I have been struggling with this for a few months now
I have tried several times to reinstall, update and change the individual libraries, but the problem always arises that the browser does not start from the php level.
Additional info:
# sudo -u www-data node -v
v23.2.0
# sudo -u www-data npm -v
10.9.0
# sudo -u www-data npm list puppeteer
(node:1791203) ExperimentalWarning: CommonJS module /usr/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /usr/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
web1@ /var/www/clients/client1/web1
└── [email protected]
# sudo -u www-data echo $PATH
/root/.nvm/versions/node/v18.20.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
# sudo -u www-data ls -ld /var/www/clients/client1/web1/web
drwxrwxrwx 6 www-data www-data 4096 Nov 15 13:05 /var/www/clients/client1/web1/web
# sudo -u www-data php -v
PHP 8.3.12 (cli) (built: Sep 27 2024 03:53:05) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.12, Copyright (c) Zend Technologies
with Zend OPcache v8.3.12, Copyright (c), by Zend Technologies
# lsb_release -a && uname -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am encountering an issue where a PHP script using Browsershot functions properly when executed from the command line, but fails to work when accessed via a URL through a web server.
This works:
sudo -u www-data php test.php
https://domain.name/test.php produces error:
Php:
I have been struggling with this for a few months now
I have tried several times to reinstall, update and change the individual libraries, but the problem always arises that the browser does not start from the php level.
Additional info:
Beta Was this translation helpful? Give feedback.
All reactions