您的位置:首页 > 编程语言 > ASP

php 使用 casperjs,解决 权限不足问题

2017-12-28 10:16 274 查看
1、安装 phantomjs 1.x

cd /usr/local
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 tar
jxvf phantomjs-1.9.8-linux-x86_64.tar.bz2
mv phantomjs-1.9.8-linux-x86_64 phantomjs

ln -s /usr/local/phantomjs/bin/phantomjs /usr/local/bin/

2、用git安装casperjs

cd /usr/local

git clone git://github.com/casperjs/casperjs.git
ln -s /usr/local/casperjs/bin/casperjs /usr/local/bin/

3、在php中调用casperjs可能需要

putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs");

再推荐个php封装casperjs的库
https://github.com/alwex/php-casperjs https://github.com/jonnnnyw/php-phantomjs
参考
https://stackoverflow.com/questions/21563640/php-execution-phantom-js-works-but-casperjs-does-not-work-permission-denied
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php casperjs phantomjs