在尝试运行我的Zend应用程序时,我的include路径出了什么问题?

时间:2013-01-11 09:00:01

标签: php apache zend-framework

我有点像我的Zend应用程序......我有一个完整的应用程序在我使用Zend框架开发的不同服务器上工作,现在我必须对软件进行一些更改。我已从服务器下载了所有代码,并根据我的信念完成了所有必要的配置,但我仍然从日志文件中收到以下错误:

==> error.log <==
[Fri Jan 11 10:49:53 2013] [error] [client 127.0.0.1] PHP Warning:  require_once(Zend/Application.php): failed to open stream: No such file or directory in /home/jonne/Koulu/exercise_project/ProjectFiles/languageTest/application/application.php on line 18
[Fri Jan 11 10:49:53 2013] [error] [client 127.0.0.1] PHP Fatal error:  require_once(): Failed opening required 'Zend/Application.php' (include_path='/home/jonne/Koulu/exercise_project/ProjectFiles/languageTest/library:.:/usr/share/php:/usr/share/pear') in /home/jonne/Koulu/exercise_project/ProjectFiles/languageTest/application/application.php on line 18

==> access.log <==
127.0.0.1 - - [11/Jan/2013:10:49:53 +0200] "GET / HTTP/1.1" 500 274 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0"

我对此很感兴趣,因为包含路径对我来说似乎正确吗?...

在路径/home/jonne/Koulu/exercise_project/ProjectFiles/languageTest/library中 我有两个指向位置的符号链接:

Zend -> /home/jonne/Koulu/exercise_project/ZendFolder/Zend
ZendX -> /home/jonne/Koulu/exercise_project/ZendFolder/ZendX

以下是Zend和ZendX文件夹的内容:

的Zend:

drwxrwxrwx  2 jonne jonne  4096 Jan 11 10:12 bin
-rwxrwxrwx  1 jonne jonne   928 Jun 13  2012 composer.json
drwxrwxrwx  3 jonne jonne  4096 Jan 11 10:12 demos
drwxrwxrwx  3 jonne jonne  4096 Jan 11 10:12 externals
drwxrwxrwx  5 jonne jonne  4096 Jan 11 10:12 extras
drwxrwxrwx  2 jonne jonne  4096 Jan 11 10:12 incubator
-rwxrwxrwx  1 jonne jonne  3438 Apr  7  2009 INSTALL.txt
drwxrwxrwx  3 jonne jonne  4096 Jan 11 10:12 library
-rwxrwxrwx  1 jonne jonne  1548 Jan  6  2010 LICENSE.txt
-rwxrwxrwx  1 jonne jonne 12209 Jun 22  2012 README.txt
drwxrwxrwx  3 jonne jonne  4096 Jan 11 10:13 resources
drwxrwxrwx  2 jonne jonne  4096 Jan 11 10:12 src
drwxrwxrwx  4 jonne jonne  4096 Jan 11 10:12 tests

ZendX:

drwxrwxrwx 3 jonne jonne 4096 Jan 11 10:13 Application
drwxrwxrwx 3 jonne jonne 4096 Jan 11 10:13 Console
drwxrwxrwx 4 jonne jonne 4096 Jan 11 10:13 Db
-rwxrwxrwx 1 jonne jonne 1137 Sep 17 11:38 Exception.php
drwxrwxrwx 5 jonne jonne 4096 Jan 11 10:13 JQuery
-rwxrwxrwx 1 jonne jonne 4958 Sep 17 11:38 JQuery.php

以下是我的application.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') : 'development'));

// 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();

以下是application.ini

的内容
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
;resources.frontController.defaultControllerName = "login"
;resources.frontController.defaultAction = "login"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.view = ""
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.layout.layout = "main"


[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

有没有人有任何建议?为什么它仍然抱怨找不到文件?!...

Thnx =)

1 个答案:

答案 0 :(得分:1)

将'Zend'符号链接更改为指向:

Zend -> /home/jonne/Koulu/exercise_project/ZendFolder/Zend/library/Zend

'ZendX'看起来很正确。 ZF应该能够在包含路径上找到Zend/Application.php,但您的符号链接指向ZF完全下载的根目录。