I am using chrome-php (https://github.com/chrome-php/chrome) to run and fetch a webpage, via google-chrome-stable installation.
Running into weird issue as I am able to run the code fine via php command line "php path/to/php/file"
However, when I run same code via browser https://example.com/php.file I get error in the log
----Failed to fetch------
Chrome process stopped before startup completed.
#0 /home/path/public_html/vendor/chrome-php/chrome/src/Utils.php(60): HeadlessChromium\Browser\BrowserProcess->HeadlessChromium\Browser\{closure}()
#1 /home/path/public_html/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php(447): HeadlessChromium\Utils::tryWithTimeout()
#2 /home/path/public_html/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php(139): HeadlessChromium\Browser\BrowserProcess->waitForStartup()
#3 /home/path/public_html/vendor/chrome-php/chrome/src/BrowserFactory.php(81): HeadlessChromium\Browser\BrowserProcess->start()
#4 /home/path/public_html/incises/browser.php(19): HeadlessChromium\BrowserFactory->createBrowser()
I increase memory of php upto 1 GB in php.ini, and execution/running time to 120 seconds even. Enabling debug log in chrome-php isn't helping either.
[2022-09-07T11:47:34.722388+00:00] chrome.DEBUG: process: using directory: /tmp/chromium-php-YpCppQ [] []
[2022-09-07T11:47:34.727105+00:00] chrome.DEBUG: process: starting process: '/usr/bin/google-chrome' '--remote-debugging-port=0' '--disable-background-networking' '--disable-background-timer-throttling' '--disable-client-side-phishing-detection' '--disable-hang-monitor' '--disable-popup-blocking' '--disable-prompt-on-repost' '--disable-sync' '--disable-translate' '--disable-features=ChromeWhatsNewUI' '--metrics-recording-only' '--no-first-run' '--safebrowsing-disable-auto-update' '--enable-automation' '--password-store=basic' '--use-mock-keychain' '--headless' '--disable-gpu' '--font-render-hinting=none' '--hide-scrollbars' '--mute-audio' '--user-data-dir=/tmp/chromium-php-YpCppQ' [] []
[2022-09-07T11:47:34.731215+00:00] chrome.DEBUG: process: waiting for 30 seconds for startup [] []
[2022-09-07T11:47:34.813653+00:00] chrome.DEBUG: process: ✗ chrome process stopped [] []
[2022-09-07T11:47:34.813862+00:00] chrome.DEBUG: process: killing chrome [] []
[2022-09-07T11:47:34.813890+00:00] chrome.DEBUG: process: cleaning temporary resources:/tmp/chromium-php-YpCppQ [] []
If I run the above command with same params with same php user, it works fine. Running out of ideas here, any help is much appreciated