Title: Why eval() wp-config?
Last modified: August 22, 2016

---

# Why eval() wp-config?

 *  Resolved [marinamix76](https://wordpress.org/support/users/marinamix76/)
 * (@marinamix76)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/why-eval-wp-config/)
 * I’m in difficult using this plugin because the “WP_DB_Connect” use the function“
   eval()” for evaluate the content of “wp-config.php” as a string . My “wp-config.
   php” contains a conditional switch. In this “switch” there is the definition 
   of the constants. Using function “eval()” returns to me an unespected database
   connection!
    There is a particular motivation of using “eval()” function? Do 
   you have any contraindications to change the “__construct” of WP_DB_Connect in
   this manner?:
 * function __construct($type=1,$filePath=’./wp-config.php’){
 *  require( $filePath );//new line
 *  $this->filePath=$filePath;
    $this->getFile(); //$this->serverBasedCondition();
 *  /**
    * eval the WP contants into PHP */ /*foreach ($this->paramA as $p) { $this-
   >evalParam(‘define(\”.$p.’\”,’\’);’); }*/
 *  $this->createConstant(‘$table_prefix=\”,”‘;”);
 *  switch ($type) {
    default: case 1: $this->conMySQL_Connect(); break; case 2:
   $this->conPDO(); break; case 3: $this->conMySQLi(); break; } }
 * Thanks,
    Marina.
 * [https://wordpress.org/plugins/cta/](https://wordpress.org/plugins/cta/)

The topic ‘Why eval() wp-config?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cta_a5a5a5.svg)
 * [WordPress Calls to Action](https://wordpress.org/plugins/cta/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cta/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cta/)
 * [Active Topics](https://wordpress.org/support/plugin/cta/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cta/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cta/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [marinamix76](https://wordpress.org/support/users/marinamix76/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/why-eval-wp-config/)
 * Status: resolved