The Little Guy Posted March 2, 2010 Share Posted March 2, 2010 I am running a script from the command line, and I am doing this: shell_exec('sh ~/processes/mini &'); When the "mini" file starts up, I get the following errors: /home/ryannaddyps/processes/mini: line 2: ?php: No such file or directory /home/ryannaddyps/processes/mini: line 3: include: command not found /home/ryannaddyps/processes/mini: line 5: //--: No such file or directory /home/ryannaddyps/processes/mini: line 7: syntax error near unexpected token `$clients,' /home/ryannaddyps/processes/mini: line 7: `function send_all_message($clients, $socket, $buf){' here is line 1-7: #!/home/ryannaddyps/php/bin/php -q <?php include 'db.php'; //-- Functions function send_all_message($clients, $socket, $buf){ both file have these permissions: rwxr-xr-x both files are exactly the same thing, only difference is filename, and they are both in the same directory. Why am I getting those errors? Link to comment https://forums.phpfreaks.com/topic/193933-errors-using-shell_exec/ Share on other sites More sharing options...
trq Posted March 3, 2010 Share Posted March 3, 2010 Your telling your shell to execute a php program using sh. Remove it. shell_exec('~/processes/mini &'); Link to comment https://forums.phpfreaks.com/topic/193933-errors-using-shell_exec/#findComment-1020744 Share on other sites More sharing options...
The Little Guy Posted March 3, 2010 Author Share Posted March 3, 2010 hmm... it works now, before it was saying I didn't have access... without sh. Link to comment https://forums.phpfreaks.com/topic/193933-errors-using-shell_exec/#findComment-1020748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.