Skip to content

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 like Ralph 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 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.

Small problem

There is still a problem with defining your own providers. I tried to add my twitter provider (yes, I can use zf to tweet!) and it won’t yet recognize it. I’ve brought this to Ralph’s attention and impressed upon him the importance of being to tweet from zf. I have no doubt that a solution will be forthcoming.
As pointed out in the comments, this has been fixed, just not documented. This page shows how to add your own providers either manually or via a command.

You can either manually add a line to your .zf.ini

basicloader.classes.0 = "My_ClassName"

or you can use zf to update itself

zf enable config.provider class-name

So now I can tweet from zf again. :)

Until next time,
I <3 |<

[Disclaimer: I use to work at Zend and still have great friends there like the lovely Nili and the walking ray of sunshine that is Andrea. That having been said, it’s been a long time since they gave me any money. So the point of this disclaimer is really just so I can mention Nili and Andrea. :) ]

10 thoughts on “How I got Zend_Tool working on Windows

  1. Good morning Liz!

    Symlinking in PHP wouldn’t do me much good in this case. (At least that I can see)

    Yes, I could have used mklink, I knew about this because I think you pointed it out to me at a conference after I went on a rant about no symlinks in Windows. I just don’t like it. In my particular case, since I updave ZF from svn, yeah, it would be easier for me to symlink but in most cases, I don’t think it’s any easier than just unzip and copy the files to the proper location.

    Thanks for stopping by! :)


  2. You could also use the ‘doskey’ command in Windows, using something such as: doskey zf=C:ZENDF~1.10binzf.bat

  3. hi,

    Copying the files all over is usually a bad idea, especially when a given app/lib/module will be updated regulary.

    As Liz pointed out, you could use symbolic on vista or later. Or, even better, simply add the ZF bin directory to your PATH.

  4. Pingback:
  5. Pingback: Zend Framework News » Blog Archive » Zend_Tool unter Windows zum Laufen bekommen

Comments are closed.