共享主机上子目录上的 Zend Framework
现在我使用的是 zf v.1.10。为了进行部署,我必须将项目上传到共享主机上的子目录。如果域名是 www.mycompany.co.id,那么我的项目地址将为 www.mycompany.co.id/myproject/。在 myproject 目录中,我像这样放置 htaccess 文件:
RewriteEngine on
RewriteRule ^(.*)$ /myproject/public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /myproject/public/index.php [NC,L]
在 public 目录中,我像这样放置 htaccess 文件:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
这是我的 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
我已经在我的项目中实现了 zend_auth 和 zend_acl ,所以第一页将显示登录表格。
问题是当我执行表单登录时,没有响应。
登录表单将定向到(操作设置为)“authentication”控制器和“loginauth”操作。
我试图在loginauth“action”中回显某些内容,但它仍然显示登录表单。
而在我的本地计算机(Windows)上,一切运行良好。
请给我建议.. 谢谢
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/public/$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..
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您使用 Zend_Form:
您可能必须“告诉”Zend_Form 使用您的控制器 baseUrl。尝试子类化 Zend_Form 并重写 setAction() 方法。
或者,您可以使用表单实例中的 setAction() 变异器。
Assuming 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.