“installing Zend Framework is so easy!!!!” yeah right…
Ok I’m working with a beginner’s book and the ONE thing that is not excessively detailed is the most important part: Installing the darn thing. After browsing the quickstart guide for hours, all it said was:
“download Zend […] add the include directory (bla bla) and YOU’RE DONE!”
right, i’m done using Zend.
Ok, not really, not yet anyway. I beg of you people, I wanna go to bed, please tell me how (in simple 6th grade detail) to install the framework. I’ve got the unzipped folder in my htdocs directory, and I placed zf.bat+zf.php in the htdocs root.
What’s next?
thank you so much.
It seems like you’re having trouble with the
PATHin the Windows command shell. This is independent of Zend Framework. Understanding thePATHconcept in a shell environment is a hurdle many programmers have to overcome, but once you get it, you can use it to increase your productivity.You can always run a program from the command shell using that program’s absolute path. For example:
You can also run a command using a relative path. That is, you enter the path from your current working directory to the location of the program you want to run.
But if you run a command in the command shell without naming the full path to the executable, the shell tries to find the program executable in one of the directories listed in your
PATHenvironment variable. That is, the path is a string with directory names separated by semicolons. To run an executable, the shell tries each directory in that list, in order, as if you hadSpecial case: running
php.exealso works if your current working directory happens to be the location of that program executable. But that’s just an example of using a relative path, using a path with zero directory levels.Second problem is that you’re running
zf.batwhich is a script that in turn invokesphp.exewithout specifying a path. It assumes you have added the location ofphp.exeto yourPATHenvironment variable.The
zf.batscript itself also needs to be found. You can do this by adding the directory where it resides to yourPATH. Assuming you installed Zend Framework underC:\zf, for example:I would also recommend that you install Zend Framework outside your
htdocsdirectory. There’s only one PHP file you need under yourhtdocs: that is the single bootstrap file that Zend Framework uses to instantiate the Front Controller and dispatch the request.When you use
zf.batto generate an skeleton application for you, it creates a directorypublicwith a PHP scriptindex.phpinside that directory. Thisindex.phpfile is the one you need to be in yourhtdocsdirectory. You also need assets like CSS, Javascript, and images to be under yourhtdocs. The rest of your application code, and the entire Zend Framework itself, should be outside yourhtdocs. Especially any config files where you store sensitive data such as your database password, etc.You can edit the
index.phpfile. It may define a PHP constantAPPLICATION_PATH, which is the location of the rest of your application code.That default definition for
APPLICATION_PATHassumes that yourhtdocsis a sister directory to the rest of your application code generated by thezf.battool. You can certainly put your app code anywhere else, but you have to change the above code so that theindex.phpscript finds it.Also the
index.phpscript may add the location of library code to PHP’sINCLUDE_PATH. This is useful if you need to make the Zend Framework library findable, or if you use other third-party PHP code in your application. Assuming you installed Zend Framework underC:\zf, you should add itslibrarysubdirectory to your PHPINCLUDE_PATH.The code templates generated by the
zf.batscript try to make sensible default guesses about where your code is located, but your environment is your own, and it’s easy to edit these scripts to specify the true location where you installed your code and libraries.