From: Rajesh Huria Date: 2010-12-07T07:37:01+09:00 Subject: Re: ruby on server side Chad Perrin wrote in post #966635: > On Tue, Dec 07, 2010 at 03:10:37AM +0900, Rajesh Huria wrote: >> >> system('ruby -v'); // This is giving proper output i.e ruby version >> system('ruby myprogram.rb'); // no action >> >> myprogram.rb is executing fine over shell but when i try to execute via >> upload.php, nothing is happening. Any idea why ruby not working on >> server side when accessing via upload.php ? > > I suspect you are having some path issues. The PHP script probably > isn't > "aware" of how to find the myprogram.rb script. Try using the full path > to the Ruby script there. I checked with getcwd(); // current working directory on server In this case, myprogram.rb lies in same directory as current working directory. do you think, its still path problem? > Then . . . assuming that works, you might want to look into how you can > make path handling a little more robust and flexible. First step, of > course, is just making sure that the Ruby program will work in this > context, and you should be able to do it with something like: > > system('ruby /absolute/path/to/myprogram.rb'); > > >> >> do i need to do anything on apache side? > > It's probably related to the execution context of your PHP script (what > it "thinks" is its current working directory) and the location of your > Ruby program. current working directory and location of ruby program is same >> i dont have any ruby handler installed on apache? is this could be the >> reason? > > That should not affect the execution of a Ruby script via PHP's system() > function, as far as I'm aware. -- Posted via http://www.ruby-forum.com/.