如何编辑的.htaccess部署Zend的项目对服务器的过程? [英] How to edit .htaccess in process of deployment of zend project on server?
问题描述
我想部署在服务器上的网站(http://webdeveloper.md)开发使用Zend Framework。当我进入文件管理器在我的账户上的服务器有显示结构如下:
anon_ftp
cgi-bin目录
CONF
在error_docs
等
httpdocs资料
和其他目录。
我部署我的项目在httpdocs资料,所以访问它时,也将显示标准的Zend结构(设置,应用程序,数据等)。据我了解的路径,我的网站主目录是 http://webdeveloper.md/httpdocs/public/的index.php 。我试着在主机设置插入这条路径到文档根目录。现在,当我访问webdeveloper.md在浏览器中,我得到错误404(未找到)。
我认为这个问题是在我的.htaccess文件。我没有什么改变了它,它包含标准的code:
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME -s [OR]
的RewriteCond%{} REQUEST_FILENAME -l [OR]
的RewriteCond%{} REQUEST_FILENAME -d
。重写规则^ * $ - [NC,L]
重写规则^ * $的index.php [NC,L]
我tryed修改它 - 增加了一个行:
的RewriteBase / httpdocs资料/公
那么这样的:
的RewriteBase http://webdeveloper.md/httpdocs/public
那么这个,而不是最后一行:
重写规则http://webdeveloper.md/httpdocs/public
没有什么工作!
我的configuraion.ini loks是这样的:
[制作]
resources.cachemanager.database.frontend.name =核心
resources.cachemanager.database.frontend.options.lifetime = 7200
resources.cachemanager.database.frontend.options.automatic_serialization =真
resources.cachemanager.database.backend.name =文件
resources.cachemanager.database.backend.options.cache_dir = APPLICATION_PATH/../data/cache
resources.cachemanager.database.frontendBackendAutoload = FALSE
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH/../library
bootstrap.path = APPLICATION_PATH/Bootstrap.php
bootstrap.class =引导
appnamespace =应用程序
resources.frontController.controllerDirectory = APPLICATION_PATH/控制器
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH/布局/脚本/
resources.view [] =
resources.db.adapter =PDO_MYSQL
resources.db.isDefaultTableAdapter =真
resources.db.params.dbname =数据库
resources.db.params.charset =UTF8
resources.db.params.host =本地主机
resources.db.params.username =根
resources.db.params.password =***********
resources.session.save_path = APPLICATION_PATH/../data/sessions
resources.session.use_only_cookies =真
date.timezone =欧洲/基希讷乌
[分期:生产]
[测试:制作]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.db.adapter =PDO_MYSQL
resources.db.params.dbname =数据库
resources.db.params.charset =UTF8
resources.db.params.host =本地主机
resources.db.params.username =根
resources.db.params.password =*********
[发展:生产]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.db.adapter =PDO_MYSQL
resources.db.params.dbname =数据库
resources.db.params.charset =UTF8
resources.db.params.host =本地主机
resources.db.params.username =根
resources.db.params.password =*********
我已经解决了所有问题。其实,我让的.htaccess和index.php的文件,因为它们。当我从其他用户的体验的理解,编辑.htaccess中的必要性出现在情况下,当服务器不允许修改文档根目录(最常见的情况 - 共享主机)。这不是我的情况,所以我不得不做的是在服务器上修改PHP设置。 我已经做了以下的服务器在PHP中设置的修改: 1.我改变文档根目录指向我的公用文件夹(在我的情况/ httpdocs资料/公/); 在服务器上的PHP设置2.最初的open_basedir被ROOT:/ tmp目录(或某事),我已经改变了这个值默认值; 3.我修改PHP设置session.save_path的从我的Zend项目中插入了那里的路径会话目录。 最后我不得不删除所有文件,并重新部署我的项目。 要解决所有的问题,我从服务器检讨错误日志。祝你好运!
I am trying to deploy on server web site (http://webdeveloper.md) developed using zend framework. When I enter the file manager on my account on server there is displayed following structure:
anon_ftp
cgi-bin
conf
error_docs
etc
httpdocs
and other directories.
I deployed my project in httpdocs, so when accessing it, there is displayed the standard zend structure (settings, application, data, etc.). As I understand the path to my website home directory is http://webdeveloper.md/httpdocs/public/index.php . I've tried to insert this path into Document root within hosting settings. Now when I access webdeveloper.md in browser I get error 404 (NOT FOUND).
I believe that the problem is in my .htaccess file. I have nothing changed in it and it contain standard code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I've tryed to modify it - added one more row:
RewriteBase /httpdocs/public
then this:
RewriteBase http://webdeveloper.md/httpdocs/public
then this, instead of the last row:
RewriteRule http://webdeveloper.md/httpdocs/public
Nothing works!
My configuraion.ini loks like this:
[production]
resources.cachemanager.database.frontend.name = Core
resources.cachemanager.database.frontend.options.lifetime = 7200
resources.cachemanager.database.frontend.options.automatic_serialization = true
resources.cachemanager.database.backend.name = File
resources.cachemanager.database.backend.options.cache_dir = APPLICATION_PATH "/../data/cache"
resources.cachemanager.database.frontendBackendAutoload = false
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
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 = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] =
resources.db.adapter = "PDO_MYSQL"
resources.db.isDefaultTableAdapter = true
resources.db.params.dbname = "database"
resources.db.params.charset = "utf8"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "***********"
resources.session.save_path = APPLICATION_PATH "/../data/sessions"
resources.session.use_only_cookies = true
date.timezone = "Europe/Chisinau"
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.db.adapter = "PDO_MYSQL"
resources.db.params.dbname = "database"
resources.db.params.charset = "utf8"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "*********"
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.db.adapter = "PDO_MYSQL"
resources.db.params.dbname = "database"
resources.db.params.charset = "utf8"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "*********"
I have solved all the issues. Actually, I let .htaccess and index.php files as they are. As I understood from experience of other users, the necessity to edit .htaccess appears in cases when the server doesn't allow to modify Document Root (most common case - shared hosting). This was not my situation, so all I had to do is to edit PHP settings on server. I've done following modifications in PHP settings on server: 1. I changed Document Root to point on my public folder (in my case /httpdocs/public/); 2. in PHP settings on server initially open_basedir was ROOT:/tmp (or something), I've changed this value to DEFAULT; 3. I modified in PHP settings session.save_path and inserted there the path to sessions directory from my zend project. And finally I had to remove all the files and to deploy my project again. To solve all the issues, I have reviewed error logs from server. Good luck!
这篇关于如何编辑的.htaccess部署Zend的项目对服务器的过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!