views:

438

answers:

4

I have a small application written in Zend Framework that I want to embed into Drupal Page. Both apps (ZF and Drupal) are be located at the same domain.

But per my knowledge ZF requires to be installed in the root of server, where I already have Drupal. My concern is that ZF controller will mistreat Drupal page requests as bad controller requests.

Can there be an easy solution to prevent this conflict? May be it would be easier to rewrite the app for a less restrictive framework, but I need to check I have weighed all options.

Thanks in advance, as StackOverflow has proven to be a really helpful resource and I am planning to allocate some time to help people in the domain of my expertise

A: 

Drupal will happily live inside a directory, it doesn't insist on being root. I don't know much about Zend at all.

If you want to install both of them to the root of the webserver, I think you're going to have to do a bit of custom coding. I'd probably take a peek inside Drupal's index.php and add some code that sends 404's to Zend rather instead of letting Drupal handle them. In fact, there may be a way to do this with some sort of mod_rewrite or mod_proxy magic at the Apache level.

Eli
A: 

I've run specific URLs to a ZF-based system, and allowed the rest to fall-back to index.php. It was custom code, not a Drupal installation, but I can't see that it would make any difference there.

Here's how I did it with a .htaccess file:

### Zend Framework for main site, the rest fallback to /index.php
RewriteEngine on
RewriteBase /
# Not if there is a file or directory that matches
RewriteCond %{REQUEST_FILENAME}       !-f
RewriteCond %{REQUEST_FILENAME}       !-d

RewriteRule ^register /?mod=register&    [QSA,L]
# ... and other rewrite aliases to index.php

# Alternates that redirect
RewriteRule ^friend/(.*) /friends/$1  [R=301,L]
RewriteRule ^members$ /member/        [R=301,L]

# These URLs are handled by ZF
RewriteRule ^member(.*)$ /zf.php      [L]
RewriteRule ^friends /zf.php          [L]
RewriteRule ^about/ /zf.php           [L]
RewriteRule ^faq /zf.php              [L]

As you should be able to see, the Zend Framework bootstrap is in /zf.php, not the usual /index.php

Alister Bulman
A: 

This may not be particularly helpful to you. But is there anything specifically that you need Zend for. Drupal is a pretty good framework by itself. I would hazard a guess that trying to get two working side by side would be more effort than it is worth as it is pretty non standard.

Jeremy French
A: 

Note that there already exists a Zend Framework integration module for Drupal. Using it will normally take care of the path issues.

FGM