Ali
Ali

Reputation: 7493

Creating a php script to run as cron job - using the Zend Framework library

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.

Upvotes: 3

Views: 1059

Answers (2)

David Radcliffe
David Radcliffe

Reputation: 1491

You should be able to use set_include_path to set the include path of the Zend lib.

Upvotes: 2

Pekka
Pekka

Reputation: 449435

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, and set_include_path() to force the correct include path.

Upvotes: 2

Related Questions