My guess is that your base autoloading mechanism finds all the classes and Zend_Application does not. And/Or, you have a circular require_once. That is something I struggled with this morning. Class A requires Class B and Class B requires_once class A...? So they sort of wait for each other, when you uncomment the line, you break the circle?

Raavi Raaj schreef:
OK when I uncomment the below line (line 290 in Zend/Application.php), the my app seems to function.
require_once $path;
Any clue why the above works? -R On 7/17/09, *Raavi Raaj* <[email protected] <mailto:[email protected]>> wrote:

    I have my Bootstarp in /application/Bootstrap.php. Below is the
    sample of my bootstrap
/application/Bootstrap.php <?php
    class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
    {
        protected function _initAutoload()
        {
            $moduleLoader = new Zend_Application_Module_Autoloader(array(
            'namespace' => '',
            'basePath' => APPLICATION_PATH));

            return $moduleLoader;
        }

    ...
    --------------------------------------------------------------------
/public/index.php <?php
    // 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'));

    // Set include path to vendor library
    set_include_path(implode(PATH_SEPARATOR, array(
        APPLICATION_PATH . '/../library',
        get_include_path()
    )));

    // Autoloading
    require_once 'Zend/Loader/Autoloader.php';
    $autoloader = Zend_Loader_Autoloader::getInstance();
    $autoloader->suppressNotFoundWarnings(false);

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

    ------------------------------------------------

-R

On 7/17/09, *Bart McLeod* <[email protected]
    <mailto:[email protected]>> wrote:

        And then forwarded to the wrong list, must have another coffee :-)

        Bart McLeod schreef:

            forwarded because I forgot to reply to all

            
------------------------------------------------------------------------

            Onderwerp:
            Re: [fw-mvc] Autoloading in zf 1.8.4
            Van:
            Bart McLeod <[email protected] <mailto:[email protected]>>
            Datum:
            Fri, 17 Jul 2009 14:23:23 +0200
            Aan:
            Raavi Raaj <[email protected]
            <mailto:[email protected]>>

            Aan:
            Raavi Raaj <[email protected]
            <mailto:[email protected]>>


            I think I remember, didn't use it much yet myself, only
            once  when I did a build from the commandline. Isn't the
            Bootstrap class the class that you define yourself in your
            index.php to set everything up that your application needs?

            >From the web:
            "A Bootstrap.php file exists in the "application"
            directory which represents a class called "Bootstrap".
            It's purpose is to initialise the Zend Framework, adjust
            environment settings (for example, timezone and
            error_reporting level), and otherwise make application
            specific tweaks and additions before a HTTP request is
            processed. Most tutorials take an alternative view and put
            Bootstrap code into index.php. I strongly suggest you
            avoid this and use an actual class to organise the
            Bootstrap code - it makes it a lot easier to read if
            nothing else!"

            So you just have to create it yourself. Read more here
            (for example):

            
http://blog.astrumfutura.com/archives/355-An-Example-Zend-Framework-Blog-Application-Part-3-A-Simple-Hello-World-Tutorial.html

            -Bart



            Raavi Raaj schreef:

                Even if I comment out the 'require_once
                Zend/Application.php'. I keep getting the same error.
                *Fatal error*: Class 'Bootstrap' not found in
                *C:\...\library\Zend\Application.php* on line *292*
                 -R
                 On 7/17/09, *Bart McLeod* <[email protected]
                <mailto:[email protected]> <mailto:[email protected]
                <mailto:[email protected]>>> wrote:

                   You still have a require_once
                'Zend/Application.php' so it could
                   be that you have to update your include_path after
                the upgrade?
                   Ohterwise try commenting the line where you require
                   Application.php and see if it complains about not
                finding
                   Zend_Application...

                   -Bart

                   Raavi Raaj schreef:

                       Hi,

                       Just upgraded (my zf app) form 1.7.8 to 1.8.4.
                    Everything went
                       smooth.

                       Was trying out the performance tips at
http://framework.zend.com/manual/en/performance.classloading.html#performance.classloading.striprequires.sed

                       My /public/index.php
                       ----------------
                       <?php

                       defined('APPLICATION_ENV')
                           || define('APPLICATION_ENV',
                    (getenv('APPLICATION_ENV') ?
                       getenv('APPLICATION_ENV') : 'production'));

                       defined('APPLICATION_PATH')
                           || define('APPLICATION_PATH',
                    realpath(dirname(__FILE__) .
                       '/../application'));

                       set_include_path(implode(PATH_SEPARATOR, array(
                           APPLICATION_PATH . '/../library',
                           get_include_path()
                       )));

                       require_once 'Zend/Loader/Autoloader.php';
                       Zend_Loader_Autoloader::getInstance();

                       require_once 'Zend/Application.php';

                       $application = new Zend_Application(
                           APPLICATION_ENV,
                           APPLICATION_PATH . '/configs/config.php'
                       );

                       $application->bootstrap()->run();

                       ----------------------------
                       *Commented out* all require_once statements
                    except the one in
                       Zend/Loader/Autoloader.php

                       Now I get this error...
                       *Fatal error*: Class 'Bootstrap' not found in
                       *C:\...\library\Zend\Application.php* on line *292*

                       My Bootstrap.php exists in
                    /application/Bootstrap.php

                       Any clues what I am doing wrong.

                       All help is appreciated.

                       -R

                       P.S. Without the "commenting out" of
                    require_once statements,
                       the app runs fine.





Reply via email to