AlexA
AlexA

Reputation: 4118

Several Zend framework projects in the same root folder

Zend Framework project structure presumes you run only one application per server, like localhost/guessbook, where controllers and stuff are located one folder above that level.

How can I have a few different ZF-based projects in my localhost so that to address them like I do with regular php script apps - with localhost/app1, localhost/app2?

Ideally, I want to do without DocumentRoot, I want to switch between apps instantly using browser.

Upvotes: 0

Views: 1480

Answers (3)

Abhinav
Abhinav

Reputation: 11

You can do that by making Zend Library shared with your multiple projects this Url will show you how can you do that

http://www.mauriciocuenca.com/blog/2009/03/two-or-more-zend-framework-projects-on-a-shared-host/

beside that in wamp you can configure Vhost to make multiple local domain:

http://mikebernat.com/blog/Adding_Virtual_Hosts_to_Apache_&_Wampserver

Upvotes: 1

vartec
vartec

Reputation: 134581

I don't quiet understand what's the problem? Perhaps you're referring at typical rewrite rules that send to /index.php? Well, you can change that rewriting rules from

RewriteRule ^.*$ /index.php [NC,L]

to

RewriteRule ^/app1/.*$ /app1/index.php [NC,L]
RewriteRule ^/app2/.*$ /app2/index.php [NC,L]

In bootstrap.php you define all the include path, so you can have Zend Framework libraries shared.

Upvotes: 2

Alekc
Alekc

Reputation: 4770

I think that you are wrong on this one. You can have multiple zend framework application on the same hostname. I.e. i've been using multiple magento's installation on my server in order to try out things. Zend doesn't have fixed file structure as far as i know (one of the reason of my choice of framework)

You can place even place Zend Library outside the webroot folder and call it with something like this:

$lib = realpath(dirname(basename(__FILE__)) . '/../../../lib');
set_include_path(get_include_path() . PATH_SEPARATOR . $lib);


$rootDir = dirname(dirname(__FILE__));
        define('ROOT_DIR', $rootDir);

        set_include_path(get_include_path()
            . PATH_SEPARATOR . ROOT_DIR . '/library/'
            . PATH_SEPARATOR . ROOT_DIR . '/app/models/'
        );

        include 'Zend/Loader.php';
        spl_autoload_register(array('Zend_Loader', 'autoload'));

        // Load configuration
        Zend_Registry::set('configSection', $configSection);
        $config = new Zend_Config(new Zend_Config_Ini(ROOT_DIR.'/application/config.ini', $configSection));
        Zend_Registry::set('config', $config);

Upvotes: 1

Related Questions