Is it possible to install and use ZF (+ its console tool) without access to include_path direcotory? I’ve tried adding the …Zend/library direcotry into include_path but without success.
I did it this way:
php -r 'set_include_path(get_include_path() . PATH_SEPARATOR . "/var/www/.../Zend/library")';
After var_dumping result of the function above it returned old include_path which should mean success. But next call of get_include_path() returned the old path too.
I’ve also tried to set the environment variable:
ZF_INCLUDE_PATH_PREPEND="/var/www/.../Zend/library"
There is our company framework in the old include_path directory so I can’t (even if I could I should’t) copy there the ZF library.
I think a proper framework shouldn’t rely on any global PHP settings as include_path is. I think it should be possible to set the include path somewhere in ZF internal configuration file.
edit:
I added set_include_path('/var/www/.../Zend/library') into zf.php file and the tool stopped throwing ‘wrong include_path’ error. In fact it sopped printing any output. When executing command zf create project test it does nothing. ~/.zf folder wasn’t created.
If you can’t copy the zf library in some “global” include path, e.g.
/usr/share/php/, you can still copy it where your project is and start thezftool from there. A folder structure like:Copy the
Zendfolder under library, and thezf.shandzf.phpscripts underbinand set them to be executablechmod a+x zf.sh zf.phpif they are not already.Next, if you run
/var/www/project/bin/zf.shit’ll look for zf files in the include_path, but if it’s not there, it’ll go up one folder and go into thelibraryfolder. Only if the zf library is not to be found there, it’ll die with an error. In the end, creating a new zf project is simple as:That’s it. HTH 🙂