newbtophp Posted August 29, 2009 Share Posted August 29, 2009 Im getting this error, wherever I include the config file, anyone know what this maybe caused by? Fatal error: Cannot redeclare headers() (previously declared in /home/mysite/public_html/config.php:9) in /home/mysite/public_html/config.php on line 17 Config.php: <?php //Include db connection include "db.php"; db_connect(); $siteurl="http://mysite.com"; $sitename="Mysite Name"; $youremail="[email protected]"; $alloweduses="11"; $headerad="<img src=\"images/banner.gif\" border=0>"; function headers($from,$to,$subject) { return "MIME-Version: 1.0\r\n". //optional "Content-type: text/html; charset=iso-8859-1\r\n". //optional "From: \"".$from."\"\r\n". //required "To: \"Client\" <".$to.">\r\n".//required "Date: ".date("r")."\r\n".//optional "Subject: ".$subject."\r\n";//optional } ?> db.php: <?php function db_connect() { $result = mysql_connect("localhost", "username", "password"); if(!$result) return false; if(!mysql_select_db("dbname")) return false; return $result; } ?> Link to comment https://forums.phpfreaks.com/topic/172415-solved-fatal-error-cannot-redeclare-headers/ Share on other sites More sharing options...
ignace Posted August 29, 2009 Share Posted August 29, 2009 Fatal error: Cannot redeclare headers() (previously declared in /home/mysite/public_html/config.php:9) in /home/mysite/public_html/config.php on line 17 remove the headers() function from the config.php file and put it into a separate file afterwards call it using: include_once('headers.php'); Link to comment https://forums.phpfreaks.com/topic/172415-solved-fatal-error-cannot-redeclare-headers/#findComment-909061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.