Jump to content

Recommended Posts

I have been told by my hosting company (1and1 if it makes a difference) that there are no restrictions on the shell_exec() command and safe_mode has been turned off, but I still have a problem with runing shell_exec(php ...) from within another php page.

My goal is to have a script pass variables and temporary files to another php script to run in the background, then email the result to a passed email address. Essentially:

[code]$command = 'php5 -f ~/mysite/script.php email@email.com /tmp/tempfile /tmp/tmpfile &> /dev/null &'
shell_exec($command)
[/code]

I have tested this command from an SSH terminal and the desired result occurs. I have tried:
[code]shell_exec('ls -la')
shell_exec('ps -e')
shell_exec('chmod ### file')
[/code]and all of these have completed with successful outputs. I have also tried exec, system, and `` (backticks) with the same browser result.

I have also played tag with my hosting company to no avail. They are assured that the error is in the script and at this point I am unsure. I was recommended a variation of this command from someone I would call a php guru, so I would like to believe that it should work.

I am getting frustrated as this is holding up the successful completion of a project that I would dearly love to get off my desk. Any help would be greatly appreciated.
Link to comment
https://forums.phpfreaks.com/topic/11380-shell_exec-syntax-or-server-issue/
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.