Adding custom php code

I’m trying to add some custom php code that runs during batch processing. Basically, I’m attempting to set the batch processing variables at run time. I’ve written a php file that does what I want, and works fine when called at the command line as “php batch_process.php”. But when I try to include batch_process.php in config.php, it isn’t getting run.

I’m trying to set:

Apparently config.php is being read to get these global variables, but isn’t actually being processed as a normal php file. How do I get my own custom php file included into the queue processing from the command line?

Hopefully there is a tutorial or two that will cover this. I just don’t know where to find it/them.


These are constants, not variables, so you cannot redefine them (if that is what you are trying to do).

Thank you, Duncan.

I’m commenting them out of config.php, then calling my procedure (using the php ‘include’ directive) which will work out their settings dynamically, and then set them. So, I’m not redefining them. I’m just defining them for the first time in my procedure instead of config.php.

But the point is, my procedure is not being called from config.php. My procedure creates an .ini file (if one doesn’t exist already) and uses the data in that file to work out the settings. But the ini file isn’t being created. I call:

php /home/user/public_html/lists/admin/index.php -pprocessqueue -c/home/user/public_html/lists/config/config.php

from the command line and the ini file never appears. But if I call my procedure directly, it does. Permissions are all the same in both cases. So, it appears there is something I’m not grasping about how config.php is being used when pprocessqueue is called.

Are you able to see what I’m not grasping here? Or, perhaps help me find a more appropriate place to call my procedure?