0

我已经在我的 ZendFramework 应用程序中安装了 Doctrine,并将它保存在应用程序的 Library 文件夹中。但是当我尝试运行应用程序时,我收到以下错误:

警告:require_once(Doctrine/Doctrine.php):无法打开流:第 7 行的 /var/www/square-06/application/Bootstrap.php 中没有此类文件或目录致命错误:require_once():打开失败需要' Doctrine/Doctrine.php' (include_path='/var/www/square-06/application/../library:/var/www/square-06/library:.:/usr/share/php:/usr/share /pear') 在第 7 行的 /var/www/square-06/application/Bootstrap.php

将 Doctrine 提取到我的应用程序中后,我还有什么需要做的吗?

我使用以下链接从 Github安装了启用了 Bisna Doctrine2 的教义 ZF1 框架项目。

4

1 回答 1

1

看看你的 ..\library\Doctrine 目录,看看 Doctrine.php 是否真的存在。我怀疑是这样。

我有一个我使用的骨架:https ://github.com/bubba-h57/secret-skeleton

如果您查看(https://github.com/bubba-h57/secret-skeleton/blob/master/public/index.php)文件,您会看到我在哪里设置了一些路径以确保可以找到 Doctrine并自动加载。像这样的东西:

// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

 // Define path to Zend library directory
defined('ZEND_LIB_PATH')
|| define('ZEND_LIB_PATH', realpath(dirname(__FILE__) .    '/../library/vendor/zend/framework/1.11.12/library'));

// Define path to the user library directory
defined('USER_LIB_PATH')
|| define('USER_LIB_PATH', realpath(dirname(__FILE__) . '/../library'));

// Define path to the user resource directory
defined('USER_RES_PATH')
|| define('USER_RES_PATH', realpath(dirname(__FILE__) . '/../resources'));

// Define path to the zf1-doctrine2 library directory
defined('ZF1D2_LIB_PATH')
|| define('ZF1D2_LIB_PATH', realpath(dirname(__FILE__) . '/../library/vendor/zf1-d2/library'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
ZEND_LIB_PATH,
USER_LIB_PATH,
ZF1D2_LIB_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();

您可能还想查看: http ://www.thecodehouse.com/2011/03/25/installing-doctrine-orm-in-a-zend-framework-application/ http://phphints.wordpress.com/ 2011/07/10/getting-bisna-to-work-with-doctrinecommon-2-1-0/

于 2013-03-26T15:46:41.393 回答