我无法在 Bluehost 服务器上正确设置 ZF 库的包含路径。
这是目录结构:
/root_directory
.htaccess
__/Zend
__Application(from ZF)
__library(from ZF)
__/public_html
__/public(the ZF public folder)
我从公用文件夹中删除了 .htaccess 并将其放在 root_directory 中。
.htaccess 的内容:
RewriteEngine On
RewriteRule ^.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.$
RewriteRule ^(.)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]
公共文件夹中 index.php 的内容:
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$FrontController = Zend_Controller_Front::getInstance();
$Router=$FrontController->getRouter();
Zend_Layout::startMvc(array(
"layout" => "layout",
"layoutPath" => "layouts/scripts"
));
$plugin=new Zend_Controller_Plugin_ErrorHandler();
$plugin->setErrorHandler(array("controller" =>'ApplicationError',
"action"=>'index'));
$FrontController->registerPlugin($plugin);
$application->bootstrap()
->run();
请帮助我在服务器上部署我的项目。如果还有什么我需要提及的,请告诉我。