Permission problems calling Ruby from php script


 
Thread Tools Search this Thread
Top Forums Web Development Permission problems calling Ruby from php script
# 1  
Old 08-16-2011
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:
Code:
echo exec("/usr/bin/ruby -v 2>&1");

results in:
Code:
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.
# 2  
Old 08-16-2011
It'd help to know what ruby's permissions are and what groups apache's in.
# 3  
Old 08-16-2011
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)
# 4  
Old 08-16-2011
It may be a library or file that Ruby's trying to open which you don't have permissions for, then.
# 5  
Old 08-16-2011
@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:

Code:
# /usr/bin/ruby -v

Quote:
ruby 1.8.2 (2004-12-25) [sparc-solaris2.8]
# 6  
Old 08-16-2011
Quote:
Originally Posted by dude2cool
@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:

Code:
# /usr/bin/ruby -v

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

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

# 7  
Old 08-16-2011
And as apache user, run the same. Still successful or you get permission denied error?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calling a php file from perl script..

Hi am new to perl script .. i need some useful tutorials links to learn perl script.. and a sample script to call a php file from perl script.. thanks.. (3 Replies)
Discussion started by: senkerth
3 Replies

2. Shell Programming and Scripting

problems calling out variables in a loop

good afternoon forums. i have a problem that ive been trying to work out all morning and cant seem to get my head around it. what i have in my script is individual letters saved in different variables. so if the word unix was saved then 'u' would be stored in the variable 'wvar1' 'n' in 'wvar2'... (7 Replies)
Discussion started by: strasner
7 Replies

3. Shell Programming and Scripting

Calling php from shell script

Maybe someone here can help out. I have a script cat <somefile> | while read hostname do /usr/bin/php <some php script> $hostname done This script works great for the first entry in the host list. However it will only execute and ignores the loop part. It's almost as if it loses... (4 Replies)
Discussion started by: dbakyle
4 Replies

4. Programming

problems iterating in RUBY while extracting info from YAML, Pls help!

Hi all, I am stuck with a ruby script that extracts detials from yaml file and processes accordingly. the yaml file confivnic: device: vnic1: policy: - L2 mode: active vnic2: policy: - L3 - L4 mode: active type: aggr ... (1 Reply)
Discussion started by: wrapster
1 Replies

5. UNIX for Dummies Questions & Answers

File permission problems.

Hi all, I am on SunOS 5.8 box. The problem is when i move files from one folder to another the command is executed and file is moved, but file permissions in the destination folder are "----------". i have to chmod the file and change the permissions everytime. i dont have a clue why this is... (3 Replies)
Discussion started by: The Nemi
3 Replies

6. Shell Programming and Scripting

Calling an Expect script from a Webpage using PHP

I have a webpage that is in HTML and PHP. In PHP I have tried using exec, system, shell_exec and passthru functions to call an Expect Script file (temp.exp). This Expect file spawns a telnet session that uses "expect/send" commands to retrieve information from an environmental unit (not a normal... (0 Replies)
Discussion started by: CCUSmith
0 Replies

7. Shell Programming and Scripting

Calling a shell script from php

Hi, I have a shell script and I'm trying to execute it from my php script. The command I'm using is: shell_exec("Script.sh"); Is this correct? It seems to not do anything for me. Not sure if this might be a permission issue or not. I have both scripts 777 permissions. Maybe I got the... (1 Reply)
Discussion started by: eltinator
1 Replies

8. Shell Programming and Scripting

Scripting file permission problems...

Hello all - I have two systems. 1) Linux box running Redhat 8.0 2) Tru64 box running V4.0f From the Linux box I am remotely mounting a directory (nfs mount) that resides on the Tru64 machine. The directory that is nfs mounted contains two subdirectories: my_dir1 my_dir2 I want... (3 Replies)
Discussion started by: Heron
3 Replies

9. UNIX for Dummies Questions & Answers

Calling a PHP script from cron

This is a line from my crontab: 12 12 * * * /home/users/ElburdNDL/www/backups/adddate.php The permissions of the script is 755 it should execute ok....but it doesn't. Do I somehow have to give cron the path to PHP or something? If so, how exactly? Thanks. Ed PS Am a total newbie... (10 Replies)
Discussion started by: eludlow
10 Replies

10. Programming

Problems calling external C routines from PL/SQL

Hi everybody! I'm not familiar with C programming in Unix, but I'm trying to make work an example to execute external procedures (developed in C) from PL/SQL. The example includes .c and .pc source files, which I have compiled succesfully. After that, links the .o files into .so to declare... (0 Replies)
Discussion started by: lwnorowski
0 Replies
Login or Register to Ask a Question