Zend Framework on sub directory on shared hosting
Now I'm using zf v.1.10. For deployment, I have to upload my project to a subdirectory on a shared hosting. If the domain is www.mycompany.co.id, so my project's address will be www.mycompany.co.id/myproject/. In the myproject directory, i put htaccess file like this :
RewriteEngine on
RewriteRule ^(.*)$ /myproject/p开发者_运维问答ublic/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /myproject/public/index.php [NC,L]
and in the public directory, i put htaccess file like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
and here is my application.ini :
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 1
resources.frontController.baseUrl = "/myproject"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.view.doctype = "XHTML1_TRANSITIONAL"
autoloadernamespaces.cal = "Cal_"
autoloadernamespaces.box = "Box_"
autoloadernamespaces.report = "Report_"
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = uname
resources.db.params.password = p4ssw0rd
resources.db.params.dbname = myprojct
i have implemented zend_auth and zend_acl in my project, so the first page will display login form.
The problem is when i executed the form login, there's no respon. The login form will be directed to (action is set to) "authentication" controller and "loginauth" action. I have tried to echo something in loginauth "action", but it still displayed login form. Whereas On my local computer (windows) everything is running well. Please give me advice.. thanksAssuming you use Zend_Form:
You probably will have to "tell" Zend_Form to use your controller baseUrl. Try to Sub-Class Zend_Form and override the setAction() method.
Alternatively you can use the setAction() mutator from your form instance.
精彩评论