我正在尝试使用PHP exec()
二进制casperjs
,
exec('casperjs /var/www/mysite/application/phantomjs/test.js');
但我收到了错误
Fatal: [Errno 2] No such file or directory; did you install phantomjs?
CasperJS在PhantomJS之上运行,我手动安装并在/usr/local/bin/phantomjs
和/usr/local/bin/casperjs
创建了一个链接。所以我猜猜casperjs在运行时会调用phantomjs。
然而,当我进入服务器并运行
时,它工作正常casperjs /var/www/mysite/application/phantomjs/test.js
出了什么问题?我认为casperjs
无法作为网络用户运行phantomjs
?如果这是真的,怎么解决?
答案 0 :(得分:4)
我遇到了完全相同的问题,并在此处找到了有效的解决方案:https://groups.google.com/forum/?fromgroups=#!topic/casperjs/92yUM9O0XjA
答案 1 :(得分:1)
尝试使用程序的完整路径调用exec
命令。例如
exec('/usr/local/bin/casperjs /var/www/mysite/application/phantomjs/test.js');
还要确保允许您通过Web服务器执行该程序,尤其是在使用php safe_mode on
时。看看safe_mode_exec_dir