ZEND CONFIGURATION ERROR
Posted by: kuriakosekk (---.ieaust.org.au)
Date: July 17, 2012 03:03AM

Hi all,

First of all- I'm new to Zend, my problem is below

I have an old site in Zend framework. I have downloaded all the files from the server (Linux server). I want to modify the site. So I need to set up this project in my local system.
I'm using wamp sever for the development, so I have created a folder named "water" within my "C:/wamp/www". But I got an error message when I run the project (http://localhost/water/html). See the error message

Warning: require_once(Zend/Config/Xml.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\water\html\index.php on line 6

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Config/Xml.php' (include_path='.;C:\php\pear:/usr/share/php5/library') in C:\wamp\www\water\html\index.php on line 6

Thanks in advance

Kuriakose



Below is the content of my index.php

======================

<?php
$start = microtime();
date_default_timezone_set('Australia/Sydney');
//set_include_path(get_include_path() . ':/usr/share/php5/library');
set_include_path(get_include_path() . ';C:\wamp\www\zend-server-config\library; C:\wamp\www\zend-server-config'); // newly added by me to include PEAR and ZEND folder.If I enable this line of code blank page comes up in browser

require_once 'Zend/Config/Xml.php';


define ('SITE', getenv('USE_CONFIG'));


$config = new Zend_Config_Xml('../application/includes/config.xml', SITE);

error_reporting(E_ALL | E_STRICT);

$debug = $config->debug;
if ($debug == 0) {
define ('DEBUG', 0);
ini_set('display_startup_errors', 0);
ini_set('display_errors', 0);
} else {
define ('DEBUG', 1);
ini_set ('display_startup_errors', 1);
ini_set ('display_errors', 1);
}

function debug ($data)
{
if (DEBUG === 1) {
echo '<pre>';
print_r($data);
echo '</pre>';
}
}

define ('BASE', realpath('../') . DIRECTORY_SEPARATOR);
define ('APP', BASE . 'application/');
define ('WEBROOT', BASE . 'html/');
define ('MODELS', APP . 'models/');
define ('INC', APP . 'includes/');
define ('CONTROLLERS', APP . 'controllers/');
define ('MODULES', APP . 'modules/');
define ('ADMIN', MODULES . 'admin/');
define ('VIEWS', APP . 'views/');
define ('DS', DIRECTORY_SEPARATOR);
define ('NL', "\n"winking smiley;
define ('SALT', '$1$rtymusle$');

set_include_path(get_include_path() . ':' . VIEWS . 'helpers');

require_once 'Helpers.php';
require INC . 'String.php';

//require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
require_once 'Zend/Controller/Front.php';
require_once INC . 'PublicController.php';
require_once 'Zend/Db/Table.php';
require_once 'Zend/Registry.php';
require 'Zend/Layout.php';

$options = array(
'layout' => 'default',
'layoutPath' => APP . 'layouts',
'contentKey' => 'content', // ignored when MVC not used
);

Zend_Layout::startMvc($options);


$front = Zend_Controller_Front::getInstance();



$front->setControllerDirectory(array(
'default' => CONTROLLERS,
'admin' => ADMIN));

//Dispatch the Front Controller
$front->dispatch();

$time = microtime() - $start;

if (DEBUG == 1) {
// echo '<!-- Page Render Time: ' . round($time, 4) . ' sec -->';
}

Options: ReplyQuote
Re: ZEND CONFIGURATION ERROR
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: July 17, 2012 04:46PM

Try this

set_include_path(get_include_path() . ';C:/wamp/www/zend-server-config/library; C:/wamp/www/zend-server-config');


i.e. change the windows '\' to a unix style '/'

PHP tends to expect the unix style slash and if its running on windiws it does the conversion internally.

Options: ReplyQuote
Re: ZEND CONFIGURATION ERROR
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: July 17, 2012 04:55PM

And another thing. You are going to have to put that change into some sort of test so that when you copy it back to the server it will use the original line and not your changed one.

Have a look at the bottom of a phpinfo() display at the section called 'PHP Variables' from your local pc and one from the server and find something that is obviously different and easy to test.

then code like

if ( strtolower( $_SERVER["DOCUMENT_ROOT"] ) == 'c:/wamp/www' )
{
Your testing version of require_once();
}
else
{
The original version of require_once();
}

Options: ReplyQuote


Sorry, only registered users may post in this forum.