Score:0

Chromium and Chromedriver do not work correctly, permission denied

cm flag

I'm trying to automate some features with php-chrome library.

I need to use chromium.chromedriver installed on my server.

So I installed these apps.

root@afs2:~#: google-chrome --version
Google Chrome 116.0.5845.140

and

root@afs2:~# chromedriver --version
ChromeDriver 116.0.5845.96 (1a391816688002153ef791ffe60d9e899a71a037-refs/branch-heads/5845@{#1382})

But when I try to use chromedriver, I have this errors:

Fatal error: Uncaught RuntimeException: Chrome process stopped before startup completed. Additional info: cmd_run.go:1046: WARNING: cannot create user data directory: cannot update the 'current' symlink of "/var/www/snap/chromium/current": remove /var/www/snap/chromium/current: permission denied Sorry, home directories outside of /home needs configuration. See https://forum.snapcraft.io/t/11209 for details. in /var/www/afsv.com/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php:410 Stack trace: #0 /var/www/afsv.com/vendor/chrome-php/chrome/src/Utils.php(60): HeadlessChromium\Browser\BrowserProcess->HeadlessChromium\Browser{closure}() #1 /var/www/afsv.com/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php(450): HeadlessChromium\Utils::tryWithTimeout() #2 /var/www/afsv.com/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php(139): HeadlessChromium\Browser\BrowserProcess->waitForStartup() #3 /var/www/afsv.com/vendor/chrome-php/chrome/src/BrowserFactory.php(81): HeadlessChromium\Browser\BrowserProcess->start() #4 /va in /var/www/afsv.com/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php on line 410

Does anyone know how can I fix this?

Thanks in advance

cn flag
what do you get if you write in the terminal `type google-chrome` ?
Kiyarash avatar
cm flag
@hanshenrik [47555:47555:0831/105059.466408:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
cn flag
no way, I don't believe `type google-chrome` would ever give that error. screenshot?
Score:0
cn flag

given that you're using chrome-php , my best guess is that you have a problem with your \HeadlessChromium\BrowserFactory .. first run in in the terminal

type google-chrome

you should get something like

google-chrome is /snap/bin/google-chrome

then take the path from that and give it to your BrowserFactory:

$browserFactory = new \HeadlessChromium\BrowserFactory('/snap/bin/google-chrome');

and given that your google-chrome --version worked, the BrowserFactory should also be able to work with this google-chrome binary :)

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.