On 8/1/07, Thijs Lensselink <dev@xxxxxxxx> wrote: > On Wed, 1 Aug 2007 08:49:34 -0400, Jason Pruim <japruim@xxxxxxxxxx> wrote: > > Hi All :) > > > > I have a php script that I am attempting to run from the CLI to > > connect to a MySQL database and update a field. but when I run it > > with this command: php cronjob.php it prints out the script on screen > > but doesn't process it... > > > > Running: php-r"phpinfo();" prints out the standard phpinfo screen.. > > and I don't think I should have to write it differently to make it > > run from the command line right? > > > > HELP! I'm desperate... I would offer to name my first born after > > you... But he's already been born :) > > > > > > -- > > > > Jason Pruim > > Raoset Inc. > > Technology Manager > > MQC Specialist > > 3251 132nd ave > > Holland, MI, 49424 > > www.raoset.com > > japruim@xxxxxxxxxx > > > > > > > > > > Maybe you can show use some code? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Since it's being run as a cron, that indicates that it's a *nix-like machine, so .bat files are out of the question, but you're on the right track, Bastien. Jason, try creating a file like this, chmod'ing it to 0755, and running it with the full path as follows: [uname@machine dir]$ pwd /path/to/dir [uname@machine dir]$ /path/to/dir/file Provided the file is named `file` and is in the same directory as the PHP script you want to run as a cron, it should run just fine with this code: #!/bin/bash phppath=`which php` # pwd can be changed to a hard-coded directory if # the PHP file isn't in the same directory as this script. # However, make sure not to use the tickmarks (below #the tilde (~), but instead use single quotes. pwd=`pwd` # Change phpfile.php to whatever the actual name of the PHP file is. $phppath $pwd/phpfile.php >> /dev/null 2>&1 If that doesn't work, post the code from your PHP file and we can all take a look. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php