Solved

zend framework basic problem  - cannot redeclare class Zend_DB

Posted on 2010-11-16
2
1,616 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

735 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