PHP's shell_exec won't allow “Watir::Browser.new :firefox” to execute?

It't a permission problem, the PHP script runs with the permissions of the server, normally apache You can do a sudo www and try to run the script then with rb to see if there is a problem when running ruby with the server user.

It't a permission problem, the PHP script runs with the permissions of the server, normally apache. You can do a sudo www and try to run the script then with rb to see if there is a problem when running ruby with the server user.

You've confused me with the sudo www bit. Do you mean add it to the sudoers? – gabe Aug 31 at 23:21 On another thread I'm noticed someone suggesting this: "you can configure sudo to allow www-data" rel="nofollow">www-data to execute commands as vboxuser use sudo visudo to add a line to /etc/sudoers like www-data" rel="nofollow">www-data (ALL) = (vboxuser) /usr/bin/vboxmanage check man sudoers for more information" – gabe Aug 31 at 23:28 @gabe forget about sudo, just check that the server has the permission to run rb!

– powtac Sep 1 at 10:46 I know that PHP can call the ruby scripts. I've used shell_exec to call several simple scripts that mostly just do a puts to the screen - they complete. And, using puts, I can tell that it is crashing on the Waitr::Browser.

New line. – gabe Sep 1 at 16:57.

If the server is headless, you should install the headless gem so that Firefox can work. Require 'watir-webdriver' require 'headless' headless = Headless. New headless.

Start be = Watir::Browser. Start 'google.com' puts b. Title b.

Close headless. Destroy See: http://watirwebdriver.com/headless.

It's Ubuntu 10.10 Desktop not Server (I assume headless means no GUI, Gnome, etc. ). As I've stated the ruby script works end-to-end as expected when I run it from a terminal window just not when I run it from a PHP script.So the issue isn't with the server being incapable of running the watir-webdriver. What exactly does headless mean in the watir-webdriver context?

– gabe Sep 1 at 5:19 usually if you only have command line access then it is running headlessly, ie. Without any display. – Alister Scott Sep 1 at 5:54 only have command line access to what?

Ruby or ubuntu? – gabe Sep 1 at 16:55 I tested out the headless suggestion - didn't help. Again I can run the ruby script - with the headless part - from the command line of the terminal but not from PHP using shell_exec.

– gabe Sep 1 at 17:16.

I never did figure this out. Headless isn't the answer to getting PHP to exec the script. I'm pretty sure it is a permissions issue with Firefox's executable but I can't be positive until I find an actual fix.

Ultimately I've had to break up the tool where PHP manages the DB and task scheduling. Then PHP creates text files with all the data necessary for ruby to run the browser to right site, login, etc, etc... Then ruby moves the data file to one of a few different folders (success, failure, bad login, etc) and adds some text to the data file. Finally PHP parses all this info in the moved text files and updates the DB with that info.It's less than ideal but it is getting the job done.

Now I just need to figure out how to run all of this with mutliple threads... Thanks for the help.

Put the two lines of code that is below at the very top of your PHP script. The result of this is that when you browse to your PHP page with your browser it will display exactly what the errors are, including any permission errors. Ini_set("display_errors",1); error_reporting(E_ALL).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions