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

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)