i'm using linux.
i have a log file which is automatic update.
can i write php code as a cron to read log file and update a database?
help me!!!

    php-scripts are also executable via commandline, but you need a fairly new version
    search for a php binary named php (obviously)
    with that you are able to exec. phpfiles

    this can be added to your crontab like any other script (maybe in the form "php script.php")

      Hello,

      I run my php based cron jobs via Webmin , using following code:

      /usr/local/bin/php /home/point/www/newsupdate.php

      Roy

        Summarizing all of the above:
        There are two simle ways doing this:

        • Through the webbrowser

        • One the command line

        Depending on you installation you might've installed PHP as a command line tool (I'm running 4.3.0, and it works fine). The file you'll need to look for is called [FONT=courier new]php[/FONT], and is typically found under [FONT=courier new]/usr/local/bin[/FONT]. There are loads of tutorials on how to create command-line (CLI) PHP-scripts, so I'm not going to explain that here..

        If you're php-installation doesn't support CLI-scripts, you might be able to solve this problem this way instead:

        • Create a dir under your webroot (ie [FONT=courier new]/usr/local/www/www.your_host.com/this_is_the_new_dir[/FONT]).

        • Create your script as a standard PHP-script and store in the newly created dir.

        • Make sure the dir is password-protected (how this is done depends on your http daemon).

        • Create a cron job that executes lynx like this:
          [FONT=courier new]lynx -dump [url]http://username:password@www.your_host.com[/url][/FONT]

        This ought to do it.. 🙂

        Good luck!
        Olle

          Write a Reply...