gpt4 book ai didi

zend-framework - 将项目从 win7 移动到 Ubuntu 时无法加载 Zend/Application.php

转载 作者:行者123 更新时间:2023-12-04 19:23:40 26 4
gpt4 key购买 nike

我有一个在 win7 中运行的项目(安装了 xampp - zend 框架 1.10.3)。但是当我将它移到 Ubuntu 时,我遇到了问题。
我的项目结构是:

Myproject
application
library
Zend
include
application.ini
etc...
index.php

这是我的 index.php:
<?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'));

define('APP_ROOT', realpath(dirname(dirname(__FILE__))));

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

require_once 'include/constant.inc.php';
require_once('include/class.phpmailer.php');

// set constant in Zend_Registry
//require_once 'Zend/Registry.php';
//Zend_Registry::set('const', $cfg);

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/../include/application.ini'
);
$application->bootstrap()
->run();

这是我的 include/application.ini:
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
phpSettings.date.timezone = "Europe/London"
;includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = ""

;resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
;resources.frontController.params.displayExceptions = 0
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules = ""

autoloaderNamespaces.Zendex = "Zendex_"


resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password =
resources.db.params.dbname = qtcms
resources.db.params.charset = "utf8"


resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] =
;resources.layout.layout = "layout"
admin.resources.layout.layout = "admin"
resources.view.doctype = "XHTML1_STRICT"
resources.view.helperPath = APPLICATION_PATH "/helpers/views/"
resources.view.helperPathPrefix = "Zend_View_Helper_"
;resources.view.params.default.basePath = APPLICATION_PATH "/layouts/default/"
;resources.view.params.default.layout = "layout"
;resources.view.params.default.layoutPath = APPLICATION_PATH "/layouts/default/default/"

;resources.view.params.admin.basePath = APPLICATION_PATH "/layouts/admin/"
;resources.view.params.admin.layout = "layout"
;resources.view.params.admin.layoutPath = APPLICATION_PATH "/layouts/admin/default/"



[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

使用这些配置,我的项目在 Windows 上运行(安装了 xampp)没有问题。

在 ubuntu 中,我按照本指南安装了 xampp:
http://humanlanguage.wordpress.com/2006/12/03/install-xampp-on-ubuntu/

根据该指南,我创建了一个符号链接(symbolic link)(如果我没记错的话)来链接我的 /home/truong/webdev 带有 的文件夹/opt/lampp/htdocs 文件夹。(“truong”是我的名字^_^)
然后我将我的项目移动到/home/truong/webdev。之后,我从浏览器 ULR 运行我的项目: 本地主机/webdev/myProject
我有这个错误:
Warning: require_once(Zend/Application.php) [function.require-once]: failed to open stream: No such file or directory in /home/truong/webdev/qtcms/index.php on line 28

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Application.php' (include_path=':.:/opt/lampp/lib/php') in /home/truong/webdev/qtcms/index.php on line 28

看起来系统找不到我的 library/Zend 文件夹。

我想知道我是否应该在 php.ini 中手动设置 Zend 库的包含路径,但后来我认为这不是必需的,因为我在 index.php 中设置了它
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));

我在 Internet 上搜索了很多次,但没有发现任何有用的信息。
请帮我解决这个问题...
非常感谢。
ps:我为我糟糕的英语道歉。
quangtruong1985

帖子:1
加入时间:2011 年 1 月 6 日星期四下午 4:24

最佳答案

似乎您的库路径实际上并未添加到您的包含路径中。
您可能想通过 print_r(get_include_path()); 进行检查

过去我在 realpath 上遇到了一些问题,所以这可能是导致您的问题的原因。
你可以试试

set_include_path(implode(PATH_SEPERATOR, array(
dirname(__FILE__) . '/library',
get_include_path(),
)));

避免真实路径

关于zend-framework - 将项目从 win7 移动到 Ubuntu 时无法加载 Zend/Application.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4623683/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com