Jump to content


shell_exec() syntax or server issue

  • Please log in to reply
1 reply to this topic

#1 stevenwt2

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 07 June 2006 - 03:41 AM

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:

$command = 'php5 -f ~/mysite/script.php email@email.com /tmp/tempfile /tmp/tmpfile &> /dev/null &'

I have tested this command from an SSH terminal and the desired result occurs. I have tried:
shell_exec('ls -la')
shell_exec('ps -e')
shell_exec('chmod ### file')
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.

#2 .josh

  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 07 June 2006 - 05:17 AM

i'm a noob when it comes to those functions, but i can offer a really, really dumb question instead: i don't see any ;'s on the end of your lines..maybe it's that?
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users