Reply to topic
shell_exec() or exec() in php
roedelius


Joined: 01 Feb 2007
Posts: 2
Reply with quote
hey there; I'm trying to call a php script with shell_exec() or exec(), like so:
Code:
<?php

  exec ('bash -c "exec nohup setsid /usr/bin/php script.php > /dev/null 2>&1 &"');

?>

this should run the script.php file in the background, as a separate process.
I've also tried running this:
Code:
<?php

  exec ("/usr/bin/php script.php");

?>

but neither work - I get the following results (piped to a txt file):
Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.9

No input file specified.

so PHP is being started, but it isn't seeing script.php (right?). I've tried relative and absolute paths to the script, tried using "-f", nothing.

does this have to do with /cgi-php/phpwrapper, or suexec? the fact that it's a shared environment? I found no problems in phpinfo()... but I know my script works on its own (run directly or included), and both approaches have worked in the past, on other servers/hosting co's.

any ideas? thanks!
shell_exec() or exec() in php
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic