How to Setup & Run Phantomjs on Ubuntu

How can I setup & run PhantomJS on Ubuntu?

Guidouil's answer put me on the right track. I had to add one additional symlink to /usr/bin/, and I did direct symlinks for all 3 - see below.

I'm installing on Ubuntu server Natty Narwhal.

This is exactly what I did.

cd /usr/local/share
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs

And finally when I do

phantomjs -v

I get 1.9.7

If anyone sees any problems with what I've done, please let me know.

Running phantomjs on linux using python

It very much sounds like a 64 vs 32 bits issue.

To find out whats the version of your ubuntu, you can run

$ uname -i
x86_64

Then make sure to download the correct version of phantom

  • 32 bits version: https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2
  • 64 bits version: https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2

Also make sure your lib are corresponding to the version of your OS.

How to update phantomjs 1.9.8 to phantomjs 2.1.1 on ubuntu?

I just installed phantomjs 2.1.1 in ubuntu 16.04 with the following steps, which I found after a bit of googling :

sudo apt-get install nodejs
sudo apt-get install nodejs-legacy
sudo apt-get install npm
sudo npm -g install phantomjs-prebuilt

How to Run Phantomjs on Linux Webserver

I made a couple of mistakes with this one. The golden code that did this for me was only this:

echo exec('/home/mainshee/public_html/wp-content/themes/twentyseventeen/phantom/phantomjs-directory/bin/phantomjs /home/mainshee/public_html/wp-content/themes/twentyseventeen/phantom/phantomjs-directory/examples/version.js');

The major mistake I made was that the paths were not EXACT. You would think that only including the path from he location you were already at would be adequate, but I found they want the ENTIRE path. Start to finish. I also made sure that every file I was trying to execute had 0755 permissions. The last precaution I took was to use scp to upload the phantomjs file folder rather than the traditional method. This was done to avoid any corruptions (although I am not sure if it made any difference in the end). Hope this helps somebody else!



Related Topics



Leave a reply



Submit