Jump to content

Executing shell script using exec()?


bobmct

Recommended Posts

:confused:  In my php web program I'm trying to execute a bash shell script on the web server passing to it some parameters gathered within the program.  Ideally I wouldl ike to run this script as another user.  However, I get only a return code of "1" and no other error messages that I can see.

 

I tried using system and passthru as well and I'm sure the script is executable by anyone.  I've also tried the sticky bit on the target shell script.

 

Can someone/anyone please provide some gotcha pointers about doing this?  As can be expected, after playing with this for a week now I'm extremely frustrated and nearly exhausted my resources (except for this forum).

 

Ideas/suggestions please?

 

Thanks  :wtf:

Link to comment
https://forums.phpfreaks.com/topic/249336-executing-shell-script-using-exec/
Share on other sites

I'm trying to verify that PHP is properly executing external applications, thus my example.

 

If the output of whoami is as expected, then it's a pathing or permission issue.

 

Have you read the user comments about exec in the manual? There are a lot of 'gotcha's that require a little more knowledge about your setup than you've provided.

Thanks - I do believe its a permissions issue.  I have read through all the comments under the referenced functions found in us.php.net but I will read them again.  Perhaps I've missed something.  I will post my result after I have an opportunity to reread those comments.  Bob  :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.