tags:

views:

84

answers:

2

I'm learning by reading this tutorial: Link Here's the code:

<?php

require_once 'Zend/Loader.php';

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    public static $root = '';
    public static $frontController = null;

    public static function run(){
        self::setupEnvironment();
        self::prepare();
        $response = self::$frontController->dispatch();
        self::sendResponse($response);
    }

    public static function setupEnvironment(){
        error_reporting(E_ALL|E_STRICT);
        ini_set('display_startup_errors',true);
        ini_set('display_errors',true);
        date_default_timezone_set('Europe/London');
        self::$root = realpath('..');
        define('APP_ROOT', self::$root);
        spl_autoload_register(array(__CLASS__,'autoload'));

    }
}

?>

I'm recieving this error:

Fatal error: Cannot make non static method Zend_Application_Bootstrap_Bootstrap::run() static in class Bootstrap in C:\XAMPP\xampp\htdocs\HelloWorld\application\Bootstrap.php on line 6

What am I doing wrong?

+2  A: 

Try changing public static function run(){ to public function run(){

Andrew Kolesnikov
+3  A: 

If you look carefully the error says it all:

Cannot make non static method Zend_Application_Bootstrap_Bootstrap::run() static

So remove the static modifier from the run method def.

codaddict
But the tutorial says the run() method has to be static, what do I do?
Serg