Categories


Archives


Recent Posts


Categories


Setting up a Zend Application in a Subdirectory

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

This was surprisingly tricky to figure out, although that points more to the smoothness of setting up an application when it’s living in the site root. Sorry for the brevity here, this one is here mainly for my own reference but as it may help you out of a jam I thought I’d share.

  1. Follow the Quickstart Instructions over at the manual page, using the zf command line tool to create your application outside the webroot. I like to create a folder called ZendApplications that lives next to my ZendFramework folder

  2. Rename/mv the public folder to whatever subdirectory off your site root you want your Zend Application to live (the titular Subdirectory)

  3. Change the .htaccess file created by the zf tool so it has a
    RewriteBase /subdirectory-name

  4. Tangential, but make sure your index.php page has your ZendFramwork library in its page. If you don’t want to add it to your php.ini, you can add it in with
    ini_set('include_path', ini_get('include_path') .
    ':/path/to/ZendFramework/library');

  5. Also in index.php, change the application path from realpath(dirname(__FILE__) . '/../application' to the folder where you created your project
    /path/to/ZendApplications/application-name/application

This hasn’t been tested extensively, there may be other path assumptions that the Framework or Zend_Tool makes, so use it at your own risk.

Originally published October 16, 2009

Copyright © Alan Storm 1975 – 2017 All Rights Reserved

Originally Posted: 16th October 2009