How I got Zend_Tool working on Windows

 Dear Reader,

I love Zend Framework. I love it so much I wrote the very first book about Zend Framework. (Note: It’s no longer the best Zend Framework book, but still, it’s a good one) I’ve written projects using it and I now find myself teaching another class on it. One of the cool things about Zend Framework is it’s cli tool, Zend_Tool. (zf) When zf works, it’s awesome. However, when it breaks, it’s a real pain in the butt. Thanks to buddies likeRalph Schindler though (the author of the tool) when it does break, I can usually get help getting it back up and running.

The latest version of zf that comes with Zend Framework 1.10.x and better is much better than previous version and it shows that Zend (well, at least Ralph) listens when people point out problems and work to solve them.

Even though it’s made great strides, setting up zf is still not seamless. To that end, here is my list of steps needed to setup zf.

My setup

I should note before I start that I am running Windows 7. This means symlinking stuff is right out and we have to resort to physically copying files around. On top of Windows 7, I’m running XAMPP. (anyone know, is that pronounced X-AMP ot ZAMP?) this means that my PHP sits in \xampp\php. I’ve added that directory to my WIndows path so I can execute php from any cmd window. With that understanding, here’s my list.

The steps

  1. Download Zend Framework and unpack it somewhere on your harddrive where you want it to live.
  2. Make sure php.exe is in your PATH and make sure you know where php.exe is.
  3. Find the bin directory in your Zend Framework directory. In it there are 2 files, zf.bat (or zf.sh for Linux) and zf.php. Copy those to the same directory php.exe is in. (Linux users, feel free to just symlink them)
  4. Your Zend Framework directory should contain a library directory, change directory into it.
  5. from the library directory, test your zf to make sure it works, zf show should give you what you need.
  6. Type zf --setup storage-directory On Windows 7, this will create a directory named .zf in c:\Users\<Your Profile Name>
  7. Type zf --setup config-file. On WIndows 7, this will create a file .zf.ini in c:\Users<Your Profile Name>
  8. Using your favorite text editor, open c:\Users\<Your Profile Name>\.zf.ini. There should only be a single line in it that contains the include_path zf will use. Add the full path to your Zend Framework directory here. It should end in “\library\”.

Test it

That’s all there is to getting it setup. (I remember the days when it took twice as long and required cursing just to get it working) To test it out, cd to any directory other than the Zend Framework directory and type zf show version That should give you the current version of the framework you have installed.

Now you are free to start using it to create projects, etc.

你可能感兴趣的:(windows,职场,休闲,Zend_Tool)