在Zend Framework 1.10中加载“自定义资源”

时间:2010-02-20 22:39:20

标签: php zend-framework resources

1.9.6中一切正常。我改为1.10,现在基本上每个应用程序资源都有很多警告。

看起来ZF正在我设置的“自定义资源”路径中寻找应用程序资源:pluginpaths.App_Application_Resource =“App / Application / Resource。 有什么方法可以避免这种情况!? (提前感谢你的时间)

application.ini:

resources.locale.default = sq_AL
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.frontController.throwExceptions = 0

; VIEW & HTML Markup Options
resources.view.doctype = "HTML5"
resources.view.language = "en"
resources.view.setSeparator=" - "
resources.view.helperPath.View_Helper = APPLICATION_PATH "/views/helpers"
resources.view[] = 

; custom resources
**pluginpaths.App_Application_Resource = "App/Application/Resource"**

在库/ App / Application / Resource / Cache我有一个类“App_Application_Resource_Cache扩展Zend_Application_Resource_ResourceAbstract”,我需要缓存。 问题是,现在在第一页上我有很多警告,如:

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/App/Application/Resource/Locale.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php  on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/lib64/php/modules/App/Application/Resource/Locale.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/App/Application/Resource/Frontcontroller.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/lib64/php/modules/App/Application/Resource/Frontcontroller.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/App/Application/Resource/Layout.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/lib64/php/modules/App/Application/Resource/Layout.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/./views/helpers/Doctype.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/lib64/php/modules/./views/helpers/Doctype.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/./views/helpers/HeadMeta.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/lib64/php/modules/./views/helpers/HeadMeta.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/./views/helpers/HeadTitle.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190

万一有人需要它,在引导程序中这是自动加载程序

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
 protected function _initAutoload()
    {
  $autoloader = new Zend_Application_Module_Autoloader(
   array(
          'namespace' => 'App',
          'basePath' => dirname(__FILE__),
      )
     );
     return $autoloader;
    }

2 个答案:

答案 0 :(得分:7)

@Pekka

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    //get_include_path(),
)));

通过注释掉get_include/path()(在index.php中),我已经从/ usr / share / php /中省略了包含。警告消失了。

感谢您的(精湛)协助!

显然PLESK&amp; CentOS,其中无法从虚拟主机访问PHP的包含路径!

答案 1 :(得分:5)

嗯,这个问题已在评论中排序:)将此问题作为答案,您可以接受以解决问题。

您不能从PHP脚本访问该路径,请查看错误消息(/ usr / share不在允许的目录列表中)。将包含路径更改为(我猜)/ var/home/library/Zend/应解决它。

  

显然PLESK&amp; CentOS,其中无法从虚拟主机访问PHP的包含路径!

我认为这取决于open_basedir设置禁止虚拟主机访问它们之外的任何内容,它不是特定于操作系统的。无论如何,很高兴它被整理好了!