开发者

Autoloading Zend Framework classes

Here I am getting this error whenI tri开发者_StackOverflow中文版ed to run a downloaded zend project what is this error and how it can be solved

Warning: require_once(Zend/Application.php) [function.require-once]:
failed to open stream: No such file or directory in
C:\xampp\htdocs\sandbox\public\index.php on line 18

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'));

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


You need to include the Zend Framework "library" on your include path. You can either do this globally in your php.ini file's include_path directive or more simply in your application's index.php file, eg

set_include_path(implode(PATH_SEPARATOR, array(
    '/path/to/zend/framework/library',
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path()
)));

If it's a standard ZF app, there will probably already be something like that in index.php, just add the ZF path to the array.

If you do make any changes to your php.ini file, don't forget to restart Apache.


I think the message is telling you it can't find the needed files.

Have you added Zend library to your include path as recommended in the docs?


realpath(APPLICATION_PATH . '/../../php/ZendFramework/library')

Things don't happen by magic. You have to provide the correct include_path. From what I see (C:\xampp\htdocs\sandbox\public\index.php) you have to go two directories back to C:\xampp and then up again into your library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜