Solved

zend framework basic problem  - cannot redeclare class Zend_DB

Posted on 2010-11-16
2
1,598 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
Comment Utility
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
Comment Utility
n
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now