RE: [PHP] Re: Changing the directory that PHP runs from (CLI)

From: Date: Fri, 11 Jun 2004 16:17:18 +0000
Subject: RE: [PHP] Re: Changing the directory that PHP runs from (CLI)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-188112@lists.php.net to get a copy of this message
Justin, I think I will go for the ini_set() option, seems to be the best bet to not affect anything else. Thanks. - Phil. > -----Original Message----- > From: Justin Patrin [mailto:papercrane@reversefold.com] > Sent: 11 June 2004 15:42 > To: php-general@lists.php.net > Subject: [PHP] Re: Changing the directory that PHP runs from (CLI) > > > Phil Ewington - 43 Plc wrote: > > > Hi All, > > > > I have read the manual page for 'Using PHP from the command > line' thoroughly > > and cannot find the answer to my problem. I have a script that > needs to be > > accessed from both the command line and from web browsers. I tested the > > script from the command line and all worked well. As soon as I set the > > script to run from the crontab, all my includes fail because of paths. I > > believe the manual tries to cover forcing PHP to run from an alternative > > location but makes no sense to me. Can anyone tell me what > changes I need to > > make to the following crontab entry... > > > > 0 23 * * * /usr/bin/php /path/to/my/script.php arg1 arg2 arg3 > > /dev/null > > > > TIA > > > > - Phil. > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004 > > Well, you could put your includes in a central location and set the > include_path correctly in your php.ini. If that won't work for you, you > can use chdir(dirname(realpath(__FILE))) to change to the script's > directory. You could also use ini_set to add whatever directory you need > ot the script's include_path. > > -- > paperCrane <Justin Patrin> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

« previous php.general (#188112) next »