note 54807 added to ref.exec

From: Date: Fri, 15 Jul 2005 15:48:15 +0000
Subject: note 54807 added to ref.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-92023@lists.php.net to get a copy of this message
I figure this is as good a place as any to describe how to use php with cron there are two methods, executing directly or using wget... 1) to execute directly create a php script to tell you where the php interpreter is located: type 'which php' or just run this simple script <?php passthru('which php'); ?> that should return /usr/local/bin/php or something similiar. This is the path to your php interpreter. now for your cron entry: 0 0 * * * /usr/local/bin/php /path/to/phpscript/script.php make sure this script is out of the document tree. 2) execute with wget for your cron entry: 0 0 * * * wget http://path.to/phpscript/script.php now this script has to reside in the document tree so allow for this check... <?php if ($_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR']) //execute script here else die('Invalid Access.'); ?> (and perhaps a get "?auth=password" check) ---- Manual Page -- http://www.php.net/manual/en/ref.exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54807 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54807&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54807&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54807&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54807&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54807&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54807&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54807&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#92023) next »