0

okay so i am running centos 6.5 with zpanel setup. this then has phantom js and casperjs both setup and working it the

/usr/local/bin 

directory.

i use this php command for phantomjs and casperjs

 echo exec('/usr/local/bin/casperjs --version 2>&1');

phantomjs works fine but casperjs gives me this error

sh: /usr/local/bin/casperjs: Permission denied

can anyone out there help me fix this problem it is just a pain

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.yml

output for ls -al /usr/local/bin (where i execute in 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
7
  • theres got to be somebody out there to help i have tried changing permissions i cannot use sudo due to no tty Feb 4, 2014 at 23:25
  • what are the permission of file, try to chmod a+x casperjs Feb 5, 2014 at 9:12
  • i have tried this but it still fails unfortunatly i dont know the permission i forgot the command i will have a look when i am home from college Feb 5, 2014 at 11:36
  • i have added the output in my above thread @BriceFavre Feb 5, 2014 at 17:29
  • 1
    You might try changing the permission of the target - /root/casperjs/bin/casperjs. Sym links are not affected by chmod. Ref: superuser.com/questions/303040/…
    – sudipto
    Feb 5, 2014 at 22:11

1 Answer 1

2

Another one of my own questions answered by myself I am happy that I am starting to understand this new Hobby :) well any way luckily I am using virtual box whilst developing my server to my needs and every time I complete a task like install Zpanel configure it I create a clone.

so what I done is I reverted back to my server set up before the PhantomJS and CasperJS. I then installed both PhantomJS and CasperJS using the following methods and then used my test.php script to test server functionality

Okay I used the following to install 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

Then I use these Commands For CasperJS install

# 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/

I then created this on my server

PHP Test File 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');

?>

After this I ran Test.php And got this result

Running PhantomJS version: 1.9.7
Running CasperJS version: 1.1.0-beta3

My Server Now Runs CasperJs With PhantomJS

Please Uprate This Answer if you like it :)

2
  • thanks!!putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs"); is necessary。 Apr 10, 2014 at 6:56
  • 3
    the reason of Permission denied is you install the casperjs in the /root Apr 10, 2014 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.