I am creating a php script that would be called as a cron job. However I need to use the functionalities of the Zend framework. The thing is that relative referencing of files especially in includes don’t work when programming for being run via command line so I’m stuck with how do I use the zend libraries here. I don’t want to go in and change every single require_once statement.
Share
Your PHP is probably using a different php.ini file when called through the CLI (Command Line Interface).
Use
php_sapi_name()to detect whether you’re running in CLI mode, andset_include_path()to force the correct include path.