Web Hosting Talk







View Full Version : Programme not running as owner? works on redhat but not on fedora?


bala
06-25-2005, 07:41 AM
following php code is part of my script and owned by user "X"

(X is created by WHM)

exec ("./my_shell_script.sh> /dev/null &");

and my_shell_script.sh is a shell script and diven right permission to be executed;

contents of my shell script is


#!/bin/sh

while true
do
./my_program
sleep 1
done



I can run the php script on a redhat - works fine, "my_program" is listed in the current processos and its owned by the user "X"

so the same php script can terminate the program (" my_program") since its owned by the same user /owner

but when I run the same script in Fedora "my program" is not stable (I could see multiple instances and not stable) and its owned by user "nobody" - I am unable to reminate the program becasue the programm is runnng as nobody

note: shell is enabled on both redhat and fedora accounts

is it because i am using two different operating systems or I have configured the OS differently?

please help me

Burhan
06-25-2005, 08:40 AM
Are you sure suexec is not coming into play here?

bala
06-28-2005, 03:39 PM
suexec is enabled in both systems

phil_hosting365
06-28-2005, 06:47 PM
This has nothing to do with Redhat/Fedora and everything to do with your Apache setup.

Apache by default, runs modules all under the same user (i.e. "nobody", "www", "www-data") If you happen to be using mod_php, then this is what's going to happen.

To have PHP scripts run under a particular user identification, you have a couple of courses of actions:

1. Use su-exec (it's quite possible, it's simply not setup correctly on your system)
2. Use the MPM module with Apache2 (This still doesn't work correctly as far as I know)
3. Use mod_suphp http://www.suphp.org/

Apache is configured differently on both machines. A list of LoadModule lines might give a clue, but realisitically, you're going to need to go through.

If you can get the output of httpd -L (or apache -L ... it depends what your apache binary is called) on both machines, a reasonably accurate comparison could be made. Although normally it's painstaking as both are typically quite large.

Phil.

bala
06-29-2005, 03:46 AM
thanks for the reply phil...

its working fine after recompiling the apache with phpsuexec

thanks a lot :)