Open yany88 opened 5 years ago
Same issue here
Same
Got the same issue, any news on this? It's already been a few months.
I'm having the same issue with laravel 5.7.
This may help:
composer require "jonnyw/php-phantomjs:@dev"
This may help:
composer require "jonnyw/php-phantomjs:@dev"
I have used that dev version before but it creates a new whole problems of incompatibility. and you have to use an older pahntomJs and also some tweaks to set its path. So finally i just switched to nesk/puphpeteer
Thanks.
Same issue, does anyone found solution ? (except dev version)
@allanvb I found an other package that lets you use the same syntax as "jonnnnyw/php-phantomjs" (last update was 2018-04-03). It's "josh/laravel-phantomjs" (which is more recent, last update was 2019-03-27) i didn't check but maybe it's a fork.
Anyways, after installing it you can either use the syntax in the "jonnnnyw/php-phantomjs" documentation page or stick with the way that "josh/laravel-phantomjs" gives us.
here's an example assuming that your browser is in the bin folder"/bin/phantomjs" of your root application :
$url = 'www.website.com';
$client = \JonnyW\PhantomJs\Client::getInstance();
$client->getEngine()->setPath( base_path().'/bin/phantomjs');
$request_ = $client->getMessageFactory()->createRequest($url, 'GET');
$response_ = $client->getMessageFactory()->createResponse();
$req->addHeader('user-agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15');
$client->getEngine()->addOption('--load-images=false');
$client->isLazy();
$client->send($request_, $response_);
Ps : I recommend to try it on a fresh installation of Laravel 5.8 before implementing it in your project just in case.
Remove the vendor directory completely and reinstall
rm -rf vendor
composer install
Even removing vendor dir completely and reinstall using composer does not work at all times. In production and pre-production we do this on every deploy in general, but it does not fix the issue with a non-working and missing phantomjs file.
I solved it by processing a post-script that copies phantomjs to the vendor/bin folder and made a chmod change on the file to allow read and execution.
try this : composer require neokyuubi/php-phantomjs:dev-master