Permission problems calling Ruby from php script

I'm just getting my feet wet with web development, so hopefully this is a simple thing I'm overlooking, but so far I'm stumped.

I have a php script that calls Ruby via exec(). This works fine in my test environment, but when I moved it to my production environment I run into a permissions error. At first I thought it was just the ruby script needing execute permissions, but upon further digging it looks like I can't call Ruby at all, here's a simple example that fails:

from php script:

echo exec("/usr/bin/ruby -v 2>&1");

results in:

sh: /usr/bin/ruby: Permission denied

The apache user apparently doesn't have permission to call Ruby. Does this sound like something that normally shouldn't work? I guess I'm surprised because it works fine in my test environment... obviously test and prod environments are a little different.

It'd help to know what ruby's permissions are and what groups apache's in.

Should also mention I'm just getting started with Unix...

Ruby's permissions:
-rwxr-xr-x 1 root root 150 Jul 11 2010 ruby

As far as I can tell the only group apache is in is the apache group (id -gn apache)

It may be a library or file that Ruby's trying to open which you don't have permissions for, then.

@dantes990, do you have root access on this box? If so, can you try running from the shell (not from within PHP) directly as root. Lets know if that is successful.

Something like this:

# /usr/bin/ruby -v

I have limited shell access. So, if I run that with my user account, this is the output:

ruby 1.9.2p0 (2010-08-18) [i386-linux]

And as apache user, run the same. Still successful or you get permission denied error?

Unfortunately, I don't have access to the apache account, part of the reason why this has been a pain to troubleshoot.

I could see if my hosting company will give me access... they're suggesting that what I'm trying to do won't work (running Ruby directly from PHP) and to use cgi instead. Because of this, I wanted to do more research before getting back in contact with them.

So far, none of the research I've done seems to suggest there is anything wrong with calling a ruby script from the exec() function, and it works fine in my similar test environment... not sure what to think at this point.