Closed luxint66 closed 6 years ago
Hi @luxint66
Thanks for your time. The first error with symfony is indeed probably related to the PHP version, I'm not sure why though.
For the path issue. What occurs when you just type chrome
in your terminal? If you can get it to work then it should work all good in php as well (given you use the same bash environment).
I'm closing the issue for now due to innactivity. Feel free to comment or to re-open it if it still exists
I'm trying to test your package and am getting the following error when trying to run your example...
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/scripts/browser/vendor/symfony/process/Process.php on line 140
The error seems to be triggered by this line...
$browserFactory = new BrowserFactory();
I've tracked the error down to...
$process = new Process($processString);
but on checking $processString just before the call it has content, so now I'm lost...
chrome --remote-debugging-port=0 --disable-background-networking --disable-background-timer-throttling --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-translate --metrics-recording-only --no-first-run --safebrowsing-disable-auto-update --enable-automation --password-store=basic --use-mock-keychain --headless --disable-gpu --hide-scrollbars --mute-audio --user-data-dir=/tmp/chromium-php-ndLwqS
I've installed google-chrome-stable but I wonder if it's not finding it for some reason?
I've tried for hours to fix it with no luck. Does anybody have any ideas? I'm a newb when it comes to composer so I'm more than happy to believe I've done something wrong :)
UPDATE: I noticed I had two versions of PHP installed 7.0 and 7.2, and apache was using 7. I removed 7.2 and updated the one apache uses to 7.2 so hopefully, I only have one version now.
I managed to move past the last error but now there's a new one...
Fatal error: Uncaught RuntimeException: Chrome process stopped before startup completed. Additional info: sh: chrome: command not found in /var/www/html/scripts/browser/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php:353 Stack trace: #0 /var/www/html/scripts/browser/vendor/chrome-php/chrome/src/Utils.php(51): HeadlessChromium\Browser\BrowserProcess->HeadlessChromium\Browser\{closure}(Object(Symfony\Component\Process\Process)) #1 /var/www/html/scripts/browser/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php(388): HeadlessChromium\Utils::tryWithTimeout(30000000, Object(Generator)) #2 /var/www/html/scripts/browser/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php(127): HeadlessChromium\Browser\BrowserProcess->waitForStartup(Object(Symfony\Component\Process\Process), 30000000) #3 /var/www/html/scripts/browser/vendor/chrome-php/chrome/src/BrowserFactory.php(79): HeadlessChromium\Browser\BrowserProcess->start('chrome', Array) #4 /var/www/html/scripts/browser/index.php(14): HeadlessChromium\BrowserFactory->c in /var/www/html/scripts/browser/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php on line 353
I'm sure it's the path not being set up correctly. I'll investigate further.
Well, I've finally fixed it... sort of, and as expected, it was my fault :(
The path to google-chrome isn't found so I added it manually just to test and it worked. Then I got an error that 'foo' couldn't be created, which I guess is a permissions error. I removed that and just had the script echo the page title and it worked as expected.
Not sure if it's worth leaving this here just in case somebody else has the same issues but I'll leave it up to the thread owner.
Thanks for a great piece of kit. It's going to make my job a LOT easier :)
Lux