sudo not working for apache in php

I am trying tp get php to add a system user using sudo on redhat 9.  
Apache is running under user apache, the PHP and sudo command (sudo /usr/sbin/useradd -gpods -d/home/test11 -m test11 -p q) is correct I have edited the visudo for both users apache and steve, when I type in the command (under user steve) it works, but not when running it from php

$output = system("sudo /usr/sbin/useradd -gpods -d/home/test11 -m test11 -p q", $result1);

$result1 comes out as 127

any clues as it runs fine on suse 9.1
Who is Participating?
manav_mathurConnect With a Mentor Commented:
Apache supports its own sudo mechanism called suexec. Have a look at

I assume it works by hand when you try it.

As a test replace useradd with /usr/bin/id
Does it say your root?
iqulaAuthor Commented:
Thanks for that I have discovered that a 127 is some sort of PHP system error code, I tryed what you suggested and a few other non (root/sudo) commands like whoami and get the same result 127.  I think it has something to do with with PHP running the system command, I get the same result with exec and passthru.

any ideas would be appreciated
iqulaAuthor Commented:
I had to add the ini file so apache could run it.
All Courses

From novice to tech pro — start learning today.