好的,我用zpanel设置运行centos6.5。这就有了幻影js和casperjs
/usr/local/bin 目录。
我对幻影use和casperjs使用这个php命令
echo exec('/usr/local/bin/casperjs --version 2>&1');幻影可以正常工作,但是casperjs给了我这个错误。
sh: /usr/local/bin/casperjs: Permission denied有谁能帮我解决这个问题吗?
output for ls -al casperjs
[root@cyber-hosted ~]# ls -al casperjs
total 100
drwxr-xr-x 10 apache root 4096 Feb 4 15:49 .
dr-xr-x---. 5 root root 4096 Feb 4 15:49 ..
drwxr-xr-x 2 root root 4096 Feb 4 15:49 bin
-rw-r--r-- 1 root root 1220 Feb 4 15:49 casperjs.gemspec
-rw-r--r-- 1 root root 75 Feb 4 15:49 CHANGELOG.md
-rw-r--r-- 1 root root 4929 Feb 4 15:49 CONTRIBUTING.md
-rw-r--r-- 1 root root 1524 Feb 4 15:49 CONTRIBUTORS.md
drwxr-xr-x 6 root root 4096 Feb 4 15:49 docs
drwxr-xr-x 8 root root 4096 Feb 4 15:49 .git
-rw-r--r-- 1 root root 12 Feb 4 15:49 .gitattributes
-rw-r--r-- 1 root root 71 Feb 4 15:49 .gitignore
-rw-r--r-- 1 root root 0 Feb 4 15:49 .gitmodules
-rw-r--r-- 1 root root 145 Feb 4 15:49 .jshintignore
-rw-r--r-- 1 root root 528 Feb 4 15:49 .jshintrc
-rw-r--r-- 1 root root 1066 Feb 4 15:49 LICENSE.md
-rw-r--r-- 1 root root 552 Feb 4 15:49 Makefile
drwxr-xr-x 2 root root 4096 Feb 4 15:49 modules
-rw-r--r-- 1 root root 767 Feb 4 15:49 package.json
-rw-r--r-- 1 root root 4558 Feb 4 15:49 README.md
drwxr-xr-x 2 root root 4096 Feb 4 15:49 rpm
drwxr-xr-x 2 root root 4096 Feb 4 15:49 samples
drwxr-xr-x 2 root root 4096 Feb 4 15:49 src
drwxr-xr-x 7 root root 4096 Feb 4 15:49 tests
-rw-r--r-- 1 root root 3093 Feb 4 15:49 .travis.ymlls -al /usr/local/bin的输出(在php中执行)
total 37744
drwxr-xr-x. 2 root root 4096 Feb 4 22:08 .
drwxr-xr-x. 11 root root 4096 Feb 2 00:49 ..
lrwxrwxrwx 1 root root 27 Feb 4 22:08 casperjs -> /root/casperjs/bin/ca sperjs
-rwxr-xr-x 1 root root 38641084 Feb 4 15:48 phantomjs发布于 2014-02-05 22:56:13
我自己回答了另一个问题,我很高兴我开始理解这个新的霍比:)好吧,幸运的是,我在开发我的服务器以满足我的需要的同时使用虚拟盒,每次我完成像安装Zpanel配置它这样的任务时,我都会创建一个克隆。
因此,我所做的是返回到在PhantomJS和CasperJS之前设置的服务器。然后,我使用以下方法安装了PhantomJS和CasperJS,然后使用我的test.php脚本测试服务器功能
好的,我使用下面的方法来安装PhantomJS
# wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2
# tar xvf phantomjs-1.9.1-linux-i686.tar.bz2
# cp phantomjs-1.9.1-linux-i686/bin/phantomjs /usr/local/bin然后我使用这些命令来安装CasperJS
# cd /opt
# wget https://codeload.github.com/n1k0/casperjs/legacy.zip/1.1-beta3
# unzip 1.1-beta3
# ln -s n1k0-casperjs-4f105a9/ casperjs
# ln -s /opt/casperjs/bin/casperjs /usr/local/bin/然后我在我的服务器上创建了这个
PHP测试文件Test.php
<?php
## This Function Below Sets PhantomJs So CasperJS Can Use It
putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs");
echo "Running PhantomJS version: ";
echo exec('/usr/local/bin/phantomjs --version 2>&1');
echo "<br />";
echo "Running CasperJS version: ";
echo exec('/usr/local/bin/casperjs --version 2>&1');
?>之后,我运行了Test.php并得到了这个结果
Running PhantomJS version: 1.9.7
Running CasperJS version: 1.1.0-beta3我的服务器现在使用PhantomJS运行CasperJ
如果你喜欢,请高举这个答案:)
https://stackoverflow.com/questions/21563640
复制相似问题