我正在尝试在 Ubuntu(php 版本 > 5.5)上将 PHP Phantom 与 Laravel 项目结合使用。按照此处提到的安装步骤进行操作:http://jonnnnyw.github.io/php-phantomjs/ .
我收到以下错误:
Error when executing PhantomJs procedure - File does not exist or is not executable: bin/phantomjs
甚至尝试使用 $client->setBinDir('/path/public/bin')
设置 bin 目录。还尝试了绝对路径和相对路径,但抛出了以下错误:
Call to undefined method
JonnyW\PhantomJs\Client::setBinDir()
已尝试通过互联网找到的所有方法来解决此问题。
最佳答案
来自 the docs :
By default the PhantomJS library will look for the PhantomJS executable in the bin folder relative to where your script is running ~/bin/phantomjs. If the executable cannot be found or if the path to your PhantomJS executable differs from the default location, for example you have installed PhantomJS globally, you will need to define the path to your PhantomJS executable manually.
$client->getEngine()->setPath('/path/to/phantomjs');
请注意,您不仅要提供文件夹,还要提供 PhantomJS 二进制文件的完整路径。
关于php - 在 PHP-PhantomJS 中执行 PhantomJS 程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39178809/