Pragmatism in the real world

Minor update to the Zend Framework Tutorial

I’ve updated my Zend Framework tutorial to 1.0.1 to fix all the minor errors that people have found.

Thanks guys for letting me know!

I guess it just goes to prove that that I’m not that good at proof-reading :)

12 thoughts on “Minor update to the Zend Framework Tutorial

  1. For the noobish amongst us (like me), you might have to set permissions on the library directory.
    I was getting the notice that Zend.php could not be found. I assumed I entered the path incorrectly but it turned out that while all of the other directory permissions were 755, the library was set to 700 so the tutorial would not work (couldn't find Zend.php). Once changed, everything worked as expected.

  2. I seem to be having a problem running this with Apache 1.3.34 (yes, I know), PHP 5.1.2 (irregardless of stated requirements, basics of the framework should work as intended, I'm quite certain), and the 0.1.5 version of the framework… When simply trying to get the IndexController to run as expected in any method other than the defaulted indexAction(), the Zend_Controller_Action_Exception is thrown. I could call the noRouteAction method to see that an error was occuring as well. After checking over Chris Shiflet's example (and comments) I found others were having similar problems and incorporated code in the bootstrap such as:

    //fix a problem with having the thing in a subdirectory of root…
    // Note: this specific line of code only works for one
    // directory away from root without modification…
    $url = explode ( "/", $_SERVER['REQUEST_URI']);
    $_SERVER['REQUEST_URI'] = str_replace($url[1], "", $_SERVER['REQUEST_URI']);

    Apparently, the Zend Framework currently expects not only to use mod_rewrite, but also that it is in the root www folder of the web server. This was supposedly fixed from v0.1.4 of the framework (according to a commenter in previously mentioned article), but it seems not. Everything else in my code is exactly the same as your example, including the htaccess files. If anyone has any idea as to why this is happening, be it server version, OS (Windows XP Pro SP2), or other…I'd be interested to know. I think it's a slightly ugly fix to allowing code to be run in a subdirectory.

    Thanks for the tutorial though. It's great! We'll be using it to kickstart our coding efforts with the ZF codebase.

  3. Brendon,

    Are you using the new rewriterouter like the tutorial or the "original" router? The original router, even in 0.1.5 expects to be in the root dir, but rewriterouter doesn't.

  4. Page 3, Third Paragraph. You say "pubic" when I believe you meant "public." I am far too immature to let this one slide.

  5. This is annoying. I've gone over the tutorial itself about 3 times to understand it all, but can't get the code to run properly. No, I'm absolutely sure I was using the RewriteRouter and not the Router. I went backwards with the code and tried to reduce back to the start without using the ugly hack (as I ended up having include problems later on anyway) and ended up having more problems. I downloaded your source just to see if it was my server settings – it wasn't. I then thought, perhaps it was my newlines (CRLF) so I changed it to *nix style…no dice. I completely removed my directory and started from scratch. I left your example where it was; apparently that was a mistake. I was getting redeclaration errors of the Zend class. …no idea. I deleted your example folder, I got a different error. I restarted Apache and the errors were gone – something was obviously still resident in memory…somehow. So, here I am, about 5 hours later, back to page 4 of 18.

    …and I'm still getting the same thing. I'm going to go back and do what you said about the ending php tags. Still without luck, it's taking the norouteAction (which I added for cleaner debugging). I guess I have no choice but to continue through the tutorial without interacting with it in a browser and using WinMerge to see if it can detect any differences between your version and mine. I'll just have to be sure I try to make mine as similar to yours as possible (namely, whitespace placement, and removing my norouteAction).

  6. I'd like to clarify something — my first sentence in the comment above is not to say that the tutorial given is at fault for anything, it's my development server's setup. In fact, this tutorial's absolutely great! I have made some headway. I've discovered that (1)WinMerge is not perfect, (2)there are still some errors in the tutorial (I'll email you when I fix everything on my end, Rob), and (3)it wasn't my version of PHP that was causing the error, I just upgraded to v5.1.6 with the same problem. Interestingly enough, even though I'm using the Zend_Rewrite_Router, by creating a virtual directory on my server and hand-entering proper path links, it works as it should (which was the fix for the old Zend_Router). My next step is to see if a more current version of Apache will solve the problem and that my version is to blame, as it is quite old (Apache v1.3.x's current release states there was a problem with mod_rewrite, and my version's MUCH older than the last).

  7. Hi! On page 13, there should be 'zf-tutorial/application/controllers/IndexController.php' instead 'zf-tutorial/application/views/IndexController.php' :)

  8. Okay, unless someone can prove me wrong, it appears that the problem exists on Windows' based servers running the Apache 1.3.3x webserver; anything newer will work as expected, unless of course there's a bug anyway. I tested this on Apache v2.2.3, v1.3.33, and v1.3.37 — all for Windows. Only version 2.2.3 seemed to work properly with mod_rewrite. Again, it's still entirely possible the problem lies in my httpd.conf somehow, somewhere, but I tried to match my configurations as best as possible between the servers. I hope this'll help someone else out; just in case.

  9. Yes, I only tested it on 3 versions, 2 of which were the v1.3 fork; I had hoped the most recent release would fix something. It should work on v2+. Sorry for my spam, you're more than welcome to edit it all and mush it together into 1 or 2 total replies if you'd like. :)

Comments are closed.