I’ve got several scripts that I would like to cron - they are versions of other scripts which execute ‘on the fly’. All of the scripts have what I call ‘modules’ - bits of code that get used time and again (e.g., colour definitions for GD, an INC file to connect to mySQL, header and footer type stuff). These are always called by INCLUDE or REQUIRE calls (so I only have to update one piece of code if I decide I want lines to be red instead of darkred, say).
I also like to keep prying eyes off my code as much as possible, so a normal PHP script that is activated by, say, a weblink, will actually call a script (say ‘xyz.php’) which is just an include call to xyz.inc in a protected directory… xyz.inc does the actual work.
Anyhow… cron can’t ‘do’ relative paths. So if you have a PHP script which looks like<?php require_once("../dira/dbcalls.inc"); include("../dirb/does_stuff.inc"); ... other PHP stuff (and other relative-path includes) ... ?>
Then you’re stuck if you want to cron it… even putting in an
into the initial calling script doesn’t seem to do the job (although it SHOULD set the include_path to the base directory of the site, and so should mean that one can reference relative to that).
Anybody got any ideas how to ‘tweak’ to enable relative referencing? That would help me get around having to recode every script that I want to cron (basically would involve rewriting any script that I wanted to cron, carefully copying in the include file contents wherever there is an include… the likelihood of stuffup is enormous).
Thanks in advance - if someone gets me to a solution that works and gets me out of the laborious copy-and-paste described above, I will buy them dinner anytime they are in Paris.