sridhard sridhard -4 years ago 141
PHP Question

Fatal error: Cannot redeclare user_defined_function()


Fatal error: Cannot redeclare encrypt() (previously declared in
/var/www/html/Medapps_UAT/data/config.inc.php:136)


Included config.inc.php using require_once

emp_details.php

<?php
ini_set("soap.wsdl_cache_enabled", "0");
require('lib/nusoap.php');
require('lib/nusoapmime.php');
require_once("../data/config.inc.php");
require_once("../tax_calculation.php");
.
.
.
?>


tax_calculation.php

<?php
require_once("data/config.inc.php");
?>


as i have used only require_once , but getting function redeclared .

php version 5.1.6.

Answer Source

Make sure you didn't declare the function in the same name "encrypt" in any of the included file such as 'lib/nusoap.php', 'lib/nusoapmime.php' or in your current file 'tax_calculation.php'.

If you are using any IDE like net-beans or eclipse, just import the project in the IDE and search for the function name. You can easily find the total occurrence. Then rename the function name and check.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download