Reputation: 549
May I ask for a little help with setting up phantomjs on a shared hosting server, please?
Let me run through what I have done and then ask my question.
Steps taken...
Used ‘Putty’ to check the architecture of my server, like so …
uname –m // x86_64
cat /etc/issue // Debian GNU/Linux 6.0 \n \l
I downloaded the 64bit version of ‘phantomjs-1.9.8-linux-x86_64.tar.bz2’ from this page https://bitbucket.org/ariya/phantomjs/downloads
Placed that file in a folder on my server and ran the next command in Putty …
tar -jxvf phantomjs-1.9.8-linux-x86_64.tar.bz2
The files extracted and created a directory structure, seemingly without errors. I changed to that that directory and ran ls. The phantomjs file was the only file listed.
I inspected the file with Putty …
file phantomjs
Which returned
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
Entering
echo "$PWD/phantomjs"
Gives me
/homepages/24/someNumber/htdocs/cabs/mySite/phantom/bin/phantomjs
Next I tried
/homepages/24/someNumber/htdocs/cabs/mySite/phantom/bin/phantomjs -–version
The result of which was the 'No such file or directory' error ...
-bash: /homepages/24/someNumber/htdocs/cabs/mySite/phantom/bin/: No such file or directory
However, if I just enter
/homepages/24/someNumber/htdocs/cabs/mySite/phantom/bin/
then I get
/homepages/24/someNumber/htdocs/cabs/mySite/phantom/bin/: Is a directory
May a linux novice ask for some pointers on where I have gone wrong. The readme file mentions being up and running in 5 minutes. So, I have that dreadful feeling I have missed something rather basic.
Thank you.
EDIT
permissions in the phantom directory
-rwxrwxrwx 1 u387xx ftpusers 38346752 Oct 24 2014 phantomjs
permissions in the
/homepages/24/someNumber/htdocs/cabs/mySite directory (specifically for the phantom folder)
drwxr-xr-x 7 u387xx ftpusers 4096 Jul 13 11:35 phantom
Edit
In Putty, whilst in the phantom/bin directory, if I run ~/phantomjs
**/aHigherUpFolder**/homepages/24/someNumber/htdocs/phantomjs: No such file or directory
Interesting as there is another directory further up the path now. However, trying ...
/aHigherUpFolder/homepages/24/someNumber/htdocs/cabs/mySite/phantom/bin/phantomjs --version
Still leads me to a 'No such file ...' message.
Upvotes: 5
Views: 6131
Reputation: 2079
I had this exact problem in reverse. I accidentally downloaded the 32 bit build for a 64 bit box. The underlying issue is discussed here:
https://askubuntu.com/questions/454253/how-to-run-32-bit-app-in-ubuntu-64-bit
Basically, it's just a bad error message for a binary that's missing some essential libraries.
Upvotes: 6
Reputation: 549
I'm never sure if it's the right thing to do to answer your own question. However, I resent the amount of time I have spent on this and if I can offer someone else some clues, I think that is a good thing.
My goal with my original question was to produce the result ...
1.9.8
when entering
phantomjs -v
into Putty.
Basically, for whatever reason, I needed the 32bit version of the phantomjs file. While admittedly I am a novice with Linux I thought I had approached things sensibly and identified that I needed the 64bit version, but clearly not.
Out of desperation / frustration I downloaded phantomjs-1.9.8-linux-i686.tar.bz2 from the link in the question and followed the process above to extract the archive.
I changed directories to the phantomjs/bin folder and entered ...
phantomjs -v
Presto, majico ...
1.9.8
appeared in Putty.
I have no idea why the 64bit version would not work. Perhaps it was corrupted somehow, but I doubt it. I had thought of that and re-downloaded the file a number of times.
Thank you to those that made comments and helped me. I promise I actually learnt something from them. +1'd each of them.
EDIT
And just to confirm things with PHP, too ...
$output = exec($path . "phantomjs -v" . ' 2>&1');
var_dump($output);
Also produces the expected file version info.
Upvotes: 3