View Full Version : PHP Command Linke Syntax

04-25-2004, 03:52 PM
I used the !#/usr/local/bin/php at the top of the php file that the cron is calling and it said bad interpreter, this is where the which php says it is and I also tried !#/usr/bin/php .....heres the code on the page

$query= "SELECT * FROM `user_data` WHERE 1";

$link = mysql_connect($host, $user, $pass) or die("Could not connect: " . mysql_error());

mysql_select_db($db_name, $link) or die ('Can\'t use '.$db_name.' : ' . mysql_error());

$result = mysql_query($query)or die(" Invalid query: " . mysql_error());

$id = $row[userid];
shell_exec('/usr/bin/php -q /home/iworldli/public_html/adminpnl/dogetmail.php '.$id);



Any ideas on how to get this running correctly?

04-26-2004, 04:00 AM
Hi , first off please do not cross post , I appreciate that you may be unsure which forum to post this in (as I am unsure which forum is appropriate) we can always move threads around for you !

for your question , please explain , is the script above the cron script ? , if so is it the cron script itself that fails or your shell_exec() command within it ?

/usr/local/bin/php is the most common place to find PHP & if thats what 'which' returns, then thats the one to use.

if you are exec()'ing PHP via .. say `/usr/local/bin/php -q -f /path/to/file.php` , you dont need to add the shebang line #!/usr/local/bin/php in file.php as the interpreter is already invoked (nor should it hurt as it will be ignored as a comment)