Open alexanderpavlovru opened 6 years ago
$phantomjsPath = 'node_modules/phantomjs/lib/phantom/bin/phantomjs.exe';
putenv('PHANTOMJS_EXECUTABLE=' . $phantomJsPath);
It works for me.
Does not work for me on ubuntu 16 or 18, any idea ? For me
casperjs -> ./node_modules/casperjs/bin/casperjs
phantomjs -> ./node_modules/phantomjs/bin/phantomjs
I have tried many things, last is
$command = "chmod +x ".$phantomJSExecutablePath."*";
$cmdRet = exec($command);
putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs");
$command = "export PHANTOMJS_EXECUTABLE=".$phantomJSExecutablePath."phantomjs";
self::getLogger()->debug($command);
$cmdRet = exec($command);
$systemPath = getenv('PATH');
putenv("PATH=" .$systemPath. ':'.$phantomJSExecutablePath);
$command = "ln -s ".$phantomJSExecutablePath."/phantomjs /usr/local/bin/phantomjs";
$cmdRet = exec($command);
Thanks
When I run the script in console
php index.php
it works well. But if I run it via browserhttp://localhost/
or via curl in consolecurl localhost
it gives me an errorERROR - Fatal: No such file or directory; did you install phantomjs?
My nginx config is simple
phantomjs and casperjs are installed
It is all in docker container.
Any ideas?