Solved

zend framework basic problem  - cannot redeclare class Zend_DB

Posted on 2010-11-16
2
1,604 Views
Last Modified: 2013-11-10
Hi Experts,

when trying to Zend_DB:: factory  I am getting a fatal error:

Fatal error: Cannot redeclare class Zend_Db in /usr/local/zendsvr/share/ZendFramework/library/Zend/Db.php on line 33  


ini_set('display_errors', true);
 error_reporting(E_ALL);

 $library = '/usr/local/zendsvr/share/ZendFramework/library';

 set_include_path($library);
 
  require_once 'Zend/Loader.php';
  Zend_Loader::registerAutoload();
 
  echo '<h1> my ibm is running :'.Zend_Version::VERSION;
   
 
   $options = array(Zend_DB::CASE_FOLDING => Zend_DB::CASE_UPPER);

   
   $db = Zend_DB::factory('Db2',
    array(  
 
    'host'  => '127.0.0.1',
    'dbname' => 'xxxxx',
     'username' => 'xxx',
     'password' =>'xxx',
     'os' => 'i5',
    'options' => $options)
  );
 
   
   
 
 
?>
0
Comment
Question by:iskibinska
2 Comments
 
LVL 13

Accepted Solution

by:
dsmile earned 500 total points
ID: 34152967
Seems that class Zend_Db was declared at least twice from your code.

It's hard to debug from that error, I can only suggest that you debug this way:
1. is there any more file that declare class Zend_DB? is yes then move them to other path outside your include path
2. is there any changes that Zend_Db called (using require, include) more that once? it yes then replace the call with require_once, include_once
0
 

Author Closing Comment

by:iskibinska
ID: 34234249
n
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question