Running PHP scripts with Cron Job

  • Create a PHP info page using these lines :
    <?php echo phpinfo();?>
  • Upload to your web server and run it on your browser
  • Look at the item ” Server API ” : There are two possible values to come here : 1) CGI 2) Apache
  • In my case it was CGI
  • Then we have to include the line
    #!/usr/bin/php -q

    (path to PHP installed directory. This you will get it from phpinfo file with item “Configuration File (php.ini) Path”). This should be your first line of the PHP script you have to run Cron. The PHP tag (

  • Then create the crontab using the command ” * * * * * php physical/path/to/your/file.php “
Advertisements
Running PHP scripts with Cron Job

2 thoughts on “Running PHP scripts with Cron Job

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s