简体   繁体   中英

Ubuntu + Netbeans - Zend framework fatal error due to Include path

I'm experiencing a problem with my 'include' path on my fresh install of Zend framework. i'm running Ubuntu and using Netbeans. I installed Zend via the terminal and I have copied the appropriate files to my new project.

I am currently getting this while attempting to access localhost/demoZend/public

Warning: require_once(Zend/Application.php): failed to open stream: No such file or directory in /home/mastered/public_html/demoZend/public/index.php on line 18

Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path='/home/mastered/public_html/demoZend/library:.:/opt/lampp/lib/php') in /home/mastered/public_html/demoZend/public/index.php on line 18

I have copied the 'Zend' folder with the framework into my project/library folder so the folder structure is /demoZend/library/Zend/

I have also changed the 'include' path in my php.ini from the advice of a tutorial. however this is where I have things confused.

The path reads:

include_path = ".:/usr/share/php:/usr/share/php/libzend-framework-php/"

in my apache2/php.ini aswell as my /etc/php5/cli/php.ini file.

My index.php file in my project reads as thus:

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

I haven't changed that as the file paths seem ok. I should also point out I have my web documents stored in my '~/public_html' directory, I have checked the permissions on my 'demoZend/library' folder and they have all restrictions off .

It sounds like you're following a tutorial for Zend Framework 1, but you've downloaded Zend Framework 2. There is no Zend/Application.php in ZF2, so that's why PHP isn't finding the file.

You can either head back to the ZF downloads page and grab the latest release of ZF1 (currently 1.12.3), or find a ZF2 tutorial and learn ZF2 instead. If you're just getting started with ZF, I'd go with the latter option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM