Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将index.php移出zend框架中的应用程序根目录_Php_Zend Framework_Zend Config_Zend Application_Zend App Bootstrap - Fatal编程技术网

将index.php移出zend框架中的应用程序根目录

将index.php移出zend框架中的应用程序根目录,php,zend-framework,zend-config,zend-application,zend-app-bootstrap,Php,Zend Framework,Zend Config,Zend Application,Zend App Bootstrap,我正在尝试更改index.php的路径 我有一个引导zend结构 所以我创建了一个名为newapp的新文件夹,它的路径是index.php所在的根路径 然后我将index.php复制到newapp,以便可以从newapp目录加载应用程序 但问题是,我无法从复制的index.php加载配置文件。这是下面给出的错误 Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'parse_ini_file(E:\xa

我正在尝试更改index.php的路径

我有一个引导zend结构

所以我创建了一个名为newapp的新文件夹,它的路径是index.php所在的根路径

然后我将index.php复制到newapp,以便可以从newapp目录加载应用程序

但问题是,我无法从复制的index.php加载配置文件。这是下面给出的错误

 Fatal error: Uncaught exception 'Zend_Config_Exception' with message 

'parse_ini_file(E:\xampp\htdocs\..../configs/application.ini) [<a href='function.parse-

ini-file'>function.parse-ini-file</a>]: failed to open stream: No such file or directory' 

in E:\xampp\htdocs\ZendFramework-1.12.0\library\Zend\Config\Ini.php:182
下面给出了我的实际index.php

<?php
    ini_set('memory_limit', '-1');
    set_time_limit(0);
    defined('BASE_PATH')|| define('BASE_PATH', realpath(dirname(__FILE__)));
    define('APPLICATION_PATH', BASE_PATH . '/application');

    set_include_path('../../library1.12.0/'. get_include_path());

    require_once 'Zend/Loader/Autoloader.php';
    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->setFallbackAutoloader(true);

    defined('APPLICATION_ENV')|| define('APPLICATION_ENV',(getenv

('APPLICATION_ENV') ? getenv('APPLICATION_ENV'): 'staging_mysql'));


    $application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
    );
    $application->bootstrap();
    $application->run();
尝试添加

set_include_path(
  APPLICATION_PATH.'/../library1.12.0'.PATH_SEPARATOR.
      APPLICATION_PATH.'/../library1.12.0/Zend'
);
应该是newapp/index.php中的这一行

defined('BASE_PATH')|| define('BASE_PATH', realpath(dirname(__FILE__)));
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', BASE_PATH . '/../../application');

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library1.12.0'),
    get_include_path()
)));
注意:
文件夹“library1.12.0”应位于应用程序文件夹级别,Zend文件夹应位于其中。希望这能对您有所帮助,我已经测试了它及其工作情况。

我试过了,但是:警告:require\u once(Zend/Loader/Autoloader.php)[function.require once]:无法打开流:
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__)));
define('APPLICATION_PATH', BASE_PATH . '/application');
set_include_path('../../library1.12.0/'. get_include_path());
defined('BASE_PATH')|| define('BASE_PATH', realpath(dirname(__FILE__)));
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', BASE_PATH . '/../../application');

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library1.12.0'),
    get_include_path()
)));