Page 1 of 2

Zend Framework and modules

Posted: Mon Feb 11, 2008 1:58 pm
by BornForCode
Hello this is a nightmare for me and i don't have any idea hos to fix it.
I'm working on a application that has several areas, because of that i'm thinking to use modules http://framework.zend.com/manual/en/zen ... dular.html and the following thing is happening:

http://house.bornforcode.com is working fine for default controllers, but:
http://house.bornforcode.com/admin/index (an added module is not working).

On the other side:
http://www.bornforcode.com/house/admin/index is working great, but
http://www.bornforcode.com/house/index/index is not working.

Please help :banghead: :banghead: :banghead:

Re: Zend Framework and modules

Posted: Mon Feb 11, 2008 2:26 pm
by jmut
Should be more specific.
Give router setup, your dir/module layout. and naming of classes + files.
Which version of ZF you're using?

Re: Zend Framework and modules

Posted: Mon Feb 11, 2008 2:33 pm
by BornForCode
I follow the Zend module structure:

Code: Select all

application/
    default/
        controllers/
            IndexController.php
            FooController.php
        models/
        views/
            scripts/
                index/
                foo/
            helpers/
            filters/
    blog/
        controllers/
            IndexController.php
        models/
        views/
            scripts/
                index/
            helpers/
            filters/
Controller are named according with standard: Admin_IndexController.
Version: 1.0.3

Re: Zend Framework and modules

Posted: Mon Feb 11, 2008 3:09 pm
by Christopher
Where are the 'house' and 'admin' module directories? I don't see them in your directory structure.

Re: Zend Framework and modules

Posted: Mon Feb 11, 2008 3:15 pm
by BornForCode
House doesn't exist, is the subdomain.

The admin is on the same level as blog,

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 1:19 am
by jmut
BornForCode wrote:House doesn't exist, is the subdomain.

The admin is on the same level as blog,
Clearly not the case. House is no subdomain from the url you gave... it should be module, same as admin.
You might want to play with setBaseUrl() on front controller.

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 4:06 am
by BornForCode
This is my drama, why the house is working?

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 5:05 am
by jmut
well it's just not possible. give route setup.
You're hiding something from us ;)

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 5:10 am
by BornForCode

Code: Select all

$front = Zend_Controller_Front::getInstance();
$front->addControllerDirectory('application/default/controllers')
        ->setControllerDirectory(array(
            'default'=> 'application/default/controllers',
            'admin' => 'application/admin/controllers'
        ))
        ->throwExceptions(true)
        ->setParam('noViewRenderer', true)
        ->setParam('noErrorHandler', true)      
        ->setParam('view',$view);
My htaccess:

Code: Select all

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php
 
<FilesMatch "\.(ini)$">
Order allow,deny
Deny from all
</FilesMatch>
In this format: http://localhost/project/admin/index everything works fine :( but when i upload it on a test server something is happening and i don't know what, especially when i use http://house.bornforcode.com/ as domain name :(

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 5:43 am
by jmut
as a start you should make vhost on your local pc and your project to be on webroot.
From what I see it is not webroot in your local PC and it's in webroot on remote.
From what I see you have only 2 modules. And you somehow mix the domains with the url and all
These two are completely different...unless you do some rewrite
http://house.bornforcode.com/
http://www.bornforcode.com/house/

Also tell us at the end how manu modules you want to have and what are their names.

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 6:01 am
by BornForCode
I need to have 3 modules.

I think also the problem comes on how my server works because i can access: house.bornforcode.com and also http://www.bornforcode.com/house. It seems that a subdomain is also a sub folder on my server.
My problem is when i try to use: house.bornforcode.com modules, even the default module is working with problems, for example:
- house.bornforcode.com is equiv with house.bornforcode.com/inde/index, calling it displayes "test" which is ok
- but calling house.bornforcode.com/index/mesaj displays same text when it should display "Mesaj", it seems that is redirected to same action
- if you call house.bornforcode.com/mesaj will trigger some nasty apache error :(

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 6:22 am
by jmut
After the .com part you have 3 components
.com/module/controller/action

so you should have
.com/default/index/index
.com/admin/index/index
etc

everything else is some hosting messed up magic... only modules you've registered are default and admin.

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 6:45 am
by BornForCode
Yes, that was my conclusion also but any suggestions regarding solution, because i spent my last day and today :banghead: trying to fix this and i must say that i'm defeated :crazy:

Re: Zend Framework and modules

Posted: Tue Feb 12, 2008 6:48 am
by jmut
well debug it.
check what $_SERVER['DOCUMENT_ROOT'] gives you in either cases.
even check $_SERVER as a whole
when you call as domain
house.example.com or example.com/house

Re: Zend Framework and modules

Posted: Mon Mar 03, 2008 9:13 am
by BornForCode
"DOCUMENT_ROOT"] => string(36) "/home/content/n/i/c/bornforcode/html"
["GATEWAY_INTERFACE"] => string(7) "CGI/1.1"
["HTTP_ACCEPT"] => string(99) "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
["HTTP_ACCEPT_CHARSET"] => string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
["HTTP_ACCEPT_ENCODING"] => string(12) "gzip,deflate"
["HTTP_ACCEPT_LANGUAGE"] => string(14) "en-us,en;q=0.5"
["HTTP_CACHE_CONTROL"] => string(8) "no-cache"
["HTTP_CONNECTION"] => string(10) "keep-alive"
["HTTP_COOKIE"] => string(36) "PHPSESSID=3go2qsefkrvgp1e1lsvklgqgc6"
["HTTP_HOST"] => string(21) "house.bornforcode.com"
["HTTP_KEEP_ALIVE"] => string(3) "300"
["HTTP_PRAGMA"] => string(8) "no-cache"
["HTTP_USER_AGENT"] => string(92) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12"
["PATH"] => string(28) "/bin:/usr/bin:/usr/local/bin"
["PATH_INFO"] => string(0) ""
["PHPRC"] => string(36) "/home/content/n/i/c/bornforcode/html"
["QUERY_STRING"] => string(0) ""
["REDIRECT_STATUS"] => string(3) "200"
["REDIRECT_SUBDOMAIN_DOCUMENT_ROOT"] => string(42) "/home/content/n/i/c/bornforcode/html/house"
["REDIRECT_URL"] => string(6) "/html/"
["REMOTE_PORT"] => string(5) "18745"
["REQUEST_METHOD"] => string(3) "GET"
["REQUEST_URI"] => string(6) "/html/"
["SCRIPT_FILENAME"] => string(57) "/home/content/n/i/c/bornforcode/html/house/html/index.php"
["SCRIPT_NAME"] => string(15) "/html/index.php"
["SERVER_ADDR"] => string(14) "68.178.254.202"
["SERVER_ADMIN"] => string(26) "support@supportwebsite.com"
["SERVER_NAME"] => string(21) "house.bornforcode.com"
["SERVER_PORT"] => string(2) "80"
["SERVER_PROTOCOL"] => string(8) "HTTP/1.1"
["SERVER_SIGNATURE"] => string(73) "<ADDRESS>Apache/1.3.33 Server at house.bornforcode.com Port 80</ADDRESS>
"
["SERVER_SOFTWARE"] => string(6) "Apache"
["SUBDOMAIN_DOCUMENT_ROOT"] => string(42) "/home/content/n/i/c/bornforcode/html/house"
["ORIG_PATH_INFO"] => string(15) "/html/index.php"
["ORIG_SCRIPT_NAME"] => string(15) "/html/index.php"
["ORIG_SCRIPT_FILENAME"] => string(57) "/home/content/n/i/c/bornforcode/html/house/html/index.php"
["PATH_TRANSLATED"] => string(0) ""
["PHP_SELF"] => string(15) "/html/index.php"
["REQUEST_TIME"] => int(1204557075)
}

Do you see anthing that is not ok? :(