How to execute PhantomJS on Lucee Ubuntu installation?

Hi,

I have installed PhantomJS on my Ubuntu box (which also runs Lucee).
I followed the gist: https://gist.github.com/julionc/7476620

Works like a charm from the command line:
$ phantomjs netlog.js http://www.some-website.com

I use PhantomJS to detect if a webpage has correctly loaded my script (I am
looking for actual script load).

So, now that this works with PhantomJS, I want to execute this command from
Coldfusion.
However, using execute in my Controller does nothing. No error, no result,
just nothing.
When I run it as CFEXECUTE in a template, same same. No result, no error.
I have no idea where to look, Google doesn’t have any results.

I guess it would be the same as running ANY server program, not only
PhantomJS.
So has anyone an idea how I can execute my command?

I got it working…
weird, not adding a timeout will not give you any result. It will not wait
for anything and just kill’s the execute or something.
So this code worked for me:

I made sure that the folder where phantomjs and the scripts are,are owned
by www-data and have proper rights.

Now I hope it will work also as cfscript since I am not using CFML Markup
anymore. It is 2016… :)On Friday, 10 June 2016 21:04:20 UTC+10, Mattijs Spierings wrote:

Glad to hear you have it working. It means there is hope for me.
Can you tell me where you have put your phantomjs executable?

Following the gist I posted above, it copies to:

sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

This is probably not accessible to the user that Lucee runs on.
Where should I move the executable to? I can add it to my project, or put
it somewhere that creates access for any user.

I think that might be the reason I am not seeing anything right now.

On Friday, 10 June 2016 19:58:08 UTC+10, Michael Diederich wrote:

Hi,

Am Freitag, 10. Juni 2016 11:00:08 UTC+2 schrieb Mattijs Spierings:

I guess it would be the same as running ANY server program, not only
PhantomJS.
So has anyone an idea how I can execute my command?

We use cfexecute for our phantomJS / lucee.

Good luck, it is sometimes a pain…

Michael

I did not have to put the phantomjs in my project. It sits fine in
/usr/local/shared.
Apparently it was a combination of timeout, access to the netlog.js script.

I can now run it in my CFC component as:

execute name=“phantomjs”
arguments="/var/www/fyndle/shared/backend/scripts/phantomjs/scripts/netlog.js
http://project-beauty.local" variable=“result” timeout=“30”;

Thanks for putting me on the right track Michael!On Friday, 10 June 2016 21:24:29 UTC+10, Mattijs Spierings wrote:

I got it working…
weird, not adding a timeout will not give you any result. It will not wait
for anything and just kill’s the execute or something.
So this code worked for me:

I made sure that the folder where phantomjs and the scripts are,are owned
by www-data and have proper rights.

Now I hope it will work also as cfscript since I am not using CFML Markup
anymore. It is 2016… :slight_smile:

On Friday, 10 June 2016 21:04:20 UTC+10, Mattijs Spierings wrote:

Glad to hear you have it working. It means there is hope for me.
Can you tell me where you have put your phantomjs executable?

Following the gist I posted above, it copies to:

sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

This is probably not accessible to the user that Lucee runs on.
Where should I move the executable to? I can add it to my project, or put
it somewhere that creates access for any user.

I think that might be the reason I am not seeing anything right now.

On Friday, 10 June 2016 19:58:08 UTC+10, Michael Diederich wrote:

Hi,

Am Freitag, 10. Juni 2016 11:00:08 UTC+2 schrieb Mattijs Spierings:

I guess it would be the same as running ANY server program, not only
PhantomJS.
So has anyone an idea how I can execute my command?

We use cfexecute for our phantomJS / lucee.

Good luck, it is sometimes a pain…

Michael

Glad to hear you have it working. It means there is hope for me.
Can you tell me where you have put your phantomjs executable?

Following the gist I posted above, it copies to:

sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

This is probably not accessible to the user that Lucee runs on.
Where should I move the executable to? I can add it to my project, or put
it somewhere that creates access for any user.

I think that might be the reason I am not seeing anything right now.On Friday, 10 June 2016 19:58:08 UTC+10, Michael Diederich wrote:

Hi,

Am Freitag, 10. Juni 2016 11:00:08 UTC+2 schrieb Mattijs Spierings:

I guess it would be the same as running ANY server program, not only
PhantomJS.
So has anyone an idea how I can execute my command?

We use cfexecute for our phantomJS / lucee.

Good luck, it is sometimes a pain…

Michael

Hi,Am Freitag, 10. Juni 2016 11:00:08 UTC+2 schrieb Mattijs Spierings:

I guess it would be the same as running ANY server program, not only
PhantomJS.
So has anyone an idea how I can execute my command?

We use cfexecute for our phantomJS / lucee.

Good luck, it is sometimes a pain…

Michael