>I'm unable to get exec() to start a small SAS job on my RH 6.2 box.
>(I've got file permissions set correctly)  The code:

File permissions of what for whom?


>      $command="sas -noterminal -log $SASProgDir$JobName.log ".
>        " -print $SASProgDir$JobName.lst $SASProgDir$JobName.sas";
>     print("Spawning '$command'<BR>\n");   // DEBUG STUFF!!!!
>      $ret=exec($command, $reply);
>      print("ret is '$ret'<BR>\n");   // DEBUG STUFF !!!
>      if($ret) {

Not critical yet, but $ret is going to be the first line of output when SAS
*does* work, not an error code.

If you want an error code, use the *THIRD* optional argument to exec().

The $reply has all the lines, and $ret has only the first line.  This seems
kinda silly, but I guess the goal was for quick easy hacks that expect only
one line of output to be able to get it easily, and to provide the full
output when you have more than one line.  It works. [shrug]

>          print("<BR>Ouch.  There was a system error spawning the
program.");
>          print("<BR><B>   '$prog'</B><BR>\n");
>          //print("$ret<BR>\n");
>          print("<pre>\n");
>          for ($i=0; $reply[$i]; $i++) {
>              print("$reply[$i]\n");
>          }
>          print("\n</pre>\n");
>          niceErrorMessage();
>          exit();
>      }
>
>Results in the following SAS error:
>
>   ERROR: User does not have appropriate authorization level for library
>   SASUSER.

So, not only does sas need to be executable by the PHP user (see below) but
this SASUSER library thingie, whatever it is, needs to be cleared for access
by the PHP user.

>   FATAL: Unable to initialize the options subsystem.
>   (SASXKINI): PHASE 3 KERNEL INITIALIZATION FAILED.
>   UNABLE TO INITIALIZE THE SAS KERNEL
>
>The command above:
>  'sas -noterminal -log /usr/local/bin/apache/cgi-bin/sas/remotejob.log
>   -print /usr/local/bin/apache/cgi-bin/sas/remotejob.lst
>  /usr/local/bin/apache/cgi-bin/sas/remotejob.sas'
>
>Can be executed without error in a command shell.  Any clues as to why
>PHP is choking my SAS job would be appreciated.

Because PHP is not you.

You log in as you.  A web-surfer visiting your site does not.  That's good,
because if they did, they'd have a lot more access to your machine than you
really want to give them.

PHP runs as a part of Apache (or not, if it's CGI) and runs as a particular
user, usually 'nobody', but sometimes folks set up another special user
called 'www' or 'wwwuser' or whatever they find meaningful, and give that
user even less (or at least different) access rights than 'nobody'...
Anyway, PHP runs as some user other than the one you login as, and that's
good.

You'll have to check httpd.conf and find the "User" line to see who PHP runs
as, or look at <?php phpinfo();?> or if you are using suExec (see
http://apache.org) you'll have to, errr, figure out how that works and read
httpd.conf even more carefully.

Bottom line is, the user PHP is running as does *not* have permission for
that SASUSER library thingie.

Hope that helps clarify things -- It's a tough one to wrap your brain around
(gave me a headache the first time, I know that) but it makes perfect sense
once you "get it".

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to