Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation PHP Command Linke Syntax

    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
    PHP Code:
     $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()); 

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

    mysql_close($link); 



    ?> 
    Any ideas on how to get this running correctly?

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,106
    Thanks
    11
    Thanked 101 Times in 99 Posts
    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)
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •