Page 1 of 1

Trying to configure XAmpp to work with Zend framework

PostPosted: 24. December 2008 13:37
by deola
hi , i am trying to configure Zend framework to work with XAmpp,i am using the lastest version of both Zend and Xampp ,using this file structure : Data,htdocs,templates,and includes(contain the library of Zend framework).but whenever i try to call form the web browser i get the following error:


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

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='C:\xampp\htdocs\lil\include\Zend;C:\xampp\htdocs\lil\include\Zend;.;C:\xampp\php\pear\') in C:\xampp\htdocs\lil\htdocs\index.php on line 9


=============================================================================================================================
index.php



<?php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', true);
date_default_timezone_set('Europe/London');
$rootDir = dirname(dirname(__FILE__));
$libDir = $rootDir . '\include\Zend';
set_include_path($libDir . PATH_SEPARATOR . $rootDir . '\include\Zend'. PATH_SEPARATOR . get_include_path());

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

// load the application configuration
$config = new Zend_Config_Ini('../settings.ini', 'development');
Zend_Registry::set('config', $config);


// create the application logger
$logger = new Zend_Log(new Zend_Log_Writer_Stream($config->logging->file));
Zend_Registry::set('logger', $logger);


// connect to the database
$params = array('host' => $config->database->hostname,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->database);

$db = Zend_Db::factory($config->database->type, $params);
Zend_Registry::set('db', $db);


// setup application authentication
$auth = Zend_Auth::getInstance();
$auth->setStorage(new Zend_Auth_Storage_Session());


// handle the user request
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory($config->paths->base .
'/include/Controllers');
$controller->registerPlugin(new CustomControllerAclManager($auth));

// setup the view renderer
$vr = new Zend_Controller_Action_Helper_ViewRenderer();
$vr->setView(new Templater());
$vr->setViewSuffix('tpl');
Zend_Controller_Action_HelperBroker::addHelper($vr);

$controller->dispatch();
?>

Thank you.....

Re: Trying to configure XAmpp to work with Zend framework

PostPosted: 24. December 2008 14:52
by Wiedmann
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='C:\xampp\htdocs\lil\include\Zend;C:\xampp\htdocs\lil\include\Zend;.;C:\xampp\php\pear\') in C:\xampp\htdocs\lil\htdocs\index.php on line 9

I don't know the Zend framework, but if you call the library with:
Code: Select all
require_once 'Zend/Loader.php';

You must have "'C:\xampp\htdocs\lil\include" in your include_path and not "C:\xampp\htdocs\lil\include\Zend".

I don't know which one works with Zend:
Code: Select all
$rootDir = dirname(dirname(__FILE__));
$libDir = $rootDir . '/include';
set_include_path($libDir . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader.php';


or
Code: Select all
$rootDir = dirname(dirname(__FILE__));
$libDir = $rootDir . '/include/Zend';
set_include_path($libDir . PATH_SEPARATOR . get_include_path());
require_once 'Loader.php';


(Maybe better ask in a Zend Framework support forum).