我在本地网络服务器上有一个ZF配置,一切正常。 现在我把它放在我主机的互联网上,当我加载网站时,我在屏幕上收到很多警告/致命错误。有没有人知道原因是什么?
问候埃里克
示例:
警告:is_readable()[function.is-readable]:open_basedir限制生效。 文件(/ usr / local / reserved /// sites / ericversteeg.nl / www / application /../ library / Custom / Zend / Application / Resource / View.php)不在允许的路径中:(/第198行/sites/ericversteeg.nl/www/library/Zend/Loader.php中的usr / local / reserved / index.php:/sites/ericversteeg.nl /:/ tmp)
警告:is_readable()[function.is-readable]:open_basedir限制生效。文件(/ usr / local / reserved /// sites / ericversteeg.nl / www / application /../ library / Custom / Zend / Application / Resource / View.php)不在允许的路径中:(/第198行/sites/ericversteeg.nl/www/library/Zend/Loader.php中的usr / local / reserved / index.php:/sites/ericversteeg.nl /:/ tmp)
最后是致命的:
致命错误:未捕获的异常'Zend_Controller_Response_Exception',消息'无法发送标头;标题已在/sites/ericversteeg.nl/www/library/Zend/Loader.php,第198行'/sites/ericversteeg.nl/www/library/Zend/Controller/Response/Abstract.php:323中发送。堆栈跟踪: #0 /sites/ericversteeg.nl/www/library/Zend/Controller/Response/Abstract.php(341):Zend_Controller_Response_Abstract-> canSendHeaders(true)#1 /sites/ericversteeg.nl/www/library/Zend/Controller /Response/Abstract.php(768):Zend_Controller_Response_Abstract-> sendHeaders()#2 /sites/ericversteeg.nl/www/library/Zend/Controller/Front.php(992):Zend_Controller_Response_Abstract-> sendResponse()#3 /sites/ericversteeg.nl/www/library/Zend/Application/Bootstrap/Bootstrap.php(97):Zend_Controller_Front-> dispatch()#4 /sites/ericversteeg.nl/www/library/Zend/Application.php( 366):Zend_Application_Bootstrap_Bootstrap-> run()#5 /sites/ericversteeg.nl/www/public/index.php(28):在/sites/ericversteeg.nl中抛出Zend_Application-> run()#6 {main}第323行的/www/library/Zend/Controller/Response/Abstract.php
我的index.php:
date_default_timezone_set('Europe/Paris');
// 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'
);
$application->bootstrap()
->run();
我的引导程序
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
public function _initAutoloader() {
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH,
'fallbackAutoloader' => true
));
return $autoloader;
}
protected function _initConfig() {
Zend_Registry::set('config', new Zend_Config_Ini(
APPLICATION_PATH . '/configs/application.ini',
APPLICATION_ENV,
array('allowModifications' => true)
));
$router = Zend_Controller_Front::getInstance()->getRouter();
$router->addConfig(new Zend_Config_Xml(APPLICATION_PATH . '/routes.xml'));
}
protected function _initDbAdapter() {
$this->bootstrap('db');
$db = $this->getResource('db');
if (!is_null($db)) {
Zend_Registry::set('db', $db);
} else {
throw new Zend_Exception('Cannot connect to database');
}
}
protected function _initSession() {
$resource = $this->getPluginResource('session');
Zend_Session::setOptions($resource->getOptions());
$ns = new Zend_Session_Namespace('Eric_website');
Zend_Registry::set('session', $ns);
}
protected function _initLog() {
//Zend_Registry::set('logger', new Custom_Zend_Log());
// Chrome PhpConsole
if (APPLICATION_ENV == 'development') {
Custom_PhpConsole::setEnabledOnServer();
if (Custom_PhpConsole::isEnabledOnClient()) {
Custom_PhpConsole::start(true, true, dirname(__FILE__));
//Custom_PhpConsole::$ignoreRepeatedEvents = true;
}
}
// Dummy debug function in case PhpConsole is not used
if (!function_exists('debug')) {
function debug() { }
}
$logger = new Zend_Log();
// firebug writer voor development omgeving
$writer = new Zend_Log_Writer_Firebug();
$writer->setEnabled(true);
$logger->addWriter($writer);
Zend_Registry::set('logger', $logger);
}
protected function _initView() {
// Initialize view
$view = new Zend_View();
$view->addHelperPath(APPLICATION_PATH . '/views/helpers/', 'Custom_Zend_View_Helper');
$view->addScriptPath(APPLICATION_PATH . '/views/scripts/');
$view->addScriptPath(APPLICATION_PATH . '/views/partials/');
//$view->headMeta()->appendHttpEquiv('Content-Language', Zend_Registry::get('language'));
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
$view->doctype('XHTML1_STRICT');
// Return it, so that it can be stored by the bootstrap
return $view;
}
}
我的htaccess位于root中,忽略主机上的公共目录:
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]
答案 0 :(得分:1)
如果您的服务器由Plesk或类似面板控制,那么通常将open_basedir选项设置为您的Web文件夹(基本上,这些面板的默认行为是限制您的脚本访问您的Web文件夹之外的文件) 。但是,在许多情况下,禁用此限制是有道理的并且不是滥用,例如将任何虚拟主机文件夹之外的框架作为单个副本,供不同主机上的脚本使用。
您需要将以下文本添加到vhost.conf中(通常位于/var/www/vhosts/yourdomain.com/httpdocs):
<Directory /var/www/vhosts/yourdomain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/yourdomain.com" # or /var/www/vhosts etc., depends on where do you want to include your files from, put top level dir here
php_admin_flag safe_mode off
</Directory>
之后,重新启动您的网络服务器或重建其配置而不重新启动:
websrvmng -u -vhost-name = yourdomain.com