I have a problem now with building a mechanism that allows to build console scripts with zend for app. For example like:
–scripts
—-index.php
—-basecmd.php
When basecmd contains main class for other scripts, and file structure is
include index.php
....
MyClass extends Zend_Console_Getopt{
but in index.php i need to setup APPLICATION_ENVOIRMENT with param send as –application_env to script
My problem is that I can set it when parsing params with getopt, but how to make it in index.php?
Info: I need to show error like:
‘application_env must me always set when running script’
I’d appreciate any guides for doing it.
If I’ve understood correctly, you are trying to run your application from CLI/CMD, by calling basecmd.php that will setup variables/constants for index.php to work correctly
Your basecmd.php should look something like this:
And in your index.php you should just test if constants or variables are already defined:
I hope this helps you get on the track 😉