zend-framework – 在子目录主机上部署模块化zend项目
作者:互联网
我正在将一个zend项目myproject从本地主机部署到子目录www.subdirectory.com/~username/myproject,即使我已经读到在部署zend项目时没有太多要改变的地方我面临很多问题从本地主机到子目录我已经尝试了this,我从一个答案,但它没有工作.
问题是当我把链接放在文件树上面时,项目目录打开,当我点击public时,它会将我重定向到默认模块的索引页面.我不能去任何其他页面
我无法控制apache2服务器.有没有办法部署项目,这是我的代码下面的.htaccess,index.php和application.ini任何答案或指导将有所帮助
的.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]
的index.php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define path to application directory
defined('PUBLIC_PATH')
|| define('PUBLIC_PATH', realpath(dirname(__FILE__)));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
$paths = array(realpath(dirname(_FILE_) . '/../library'), '.');
set_include_path(implode(PATH_SEPARATOR, $paths));
/* Define the base URL */
define('URL_ADDRESS', "http://" . $_SERVER['HTTP_HOST']);
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
的application.ini
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
appnamespace = "Application"
resources.frontController.params.displayExceptions = 1
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] =
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = ""
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.layout.layout = default
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =
autoloaderNamespaces.Hyderlib = "Hyderlib_"
resources.layout.pluginClass= "Hyderlib_Controller_Plugin_ModuleLayout"
resources.view[] =
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "password"
resources.db.params.username = "password"
resources.db.params.password = "password"
resources.db.params.dbname = "password"
resources.db.isDefaultTableAdapter = true
解决方法:
看看这个:.htaccess RewriteRule not working in subdirectory
我怀疑你必须编辑.htaccess以通过index.php转发除image / css / js之外的请求,而index.php不在同一目录中.
如果webserver root是〜/ username /然后将.htaccess放在那里并进行更改
RewriteRule ^.*$index.php [NC,L]
至
RewriteRule ^.*$myproject/index.php [NC,L]
可能需要进行更多更改来处理静态内容(其他重写).
标签:php,htaccess,zend-framework,subdirectory,web-deployment-project 来源: https://codeday.me/bug/20190709/1415024.html