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
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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.