View Full Version : Website bombs with PHP 5

Brendon Bauer
Jul 9, 2008, 09:17 PM
The website I run is now showing errors all over the place, or on some pages it just bombs. The server was just recently updated to PHP 5 from version 4. Check out the main page of the website: http://www.summitnorthwest.org/

See how the background is totally grey, the footer is missing, etc? I've commented out 3 parts of the code that I thought could be causing the problems, but that didn't change anything.

Any ideas what could be causing the problems? Originally it was the <?php include function but I went through and fixed those on the main page. (There are still several other pages on the website that are bombing because of the php include function, and I just haven't gotten around to fixing those yet. I'm just working on the main page for now.)

Jul 9, 2008, 09:46 PM
Find the PHP error log and see what it says. Otherwise all we can do is guess.

Jul 9, 2008, 11:46 PM
Post the code from functions.php, or PM me with the contents of that file and I'll try to help ... you have to start somewhere.

Also, on some of the pages you have URL reference issue in your includes (kids.php). Use the path to file relative to the your script calling the include instead of the whole path (i.e. ../includes/styles.php) instead of the URL of your website.

Jul 10, 2008, 08:25 AM
I found this at the end of your index file

Fatal error: Cannot redeclare semdbconnect() in /hsphere/local/home/trienell/summitnorthwest.org/html/sem2/admin/functions.php on line 13

Brendon Bauer
Jul 10, 2008, 09:47 AM
Ok I figured out why the main page is bombing. I am using SEM (simple event manager) to run the events. I have multiple instances of it running. There are 2 instances running on the main page, so I have to use a php include for both. The trick now is, it only works when I have one on there. If I put both on there, it bombs. I've tried running each of them separately and they do ok. I know SEM says its for PHP 4.x only, but couldn't I modify it for PHP 5? Here's where the next error takes us: to the functions.php file in SEM. Maybe you can figure out whats up? It talks about line 13 and not being able to declare something again, like you mentioned:

Fatal error: Cannot redeclare semdbconnect() in /hsphere/local/home/trienell/summitnorthwest.org/html/sem2/admin/functions.php on line 13

Attached is a copy of functions.php if you want to go through it. Also, here is the website for SEM if you need it: http://www.quirm.net/category.php?id=13

You could download a copy to go through the files.


Brendon Bauer
Jul 10, 2008, 07:34 PM
Nobody has any ideas? I really don't understand what the error is telling me, other than the fact that PHP 4 let it be defined twice, and PHP 5 doesn't? So how do I stop that?

Jul 10, 2008, 07:47 PM
From the error, it sounds like the function name SEMDBConnect is being declared twice. Is it possible you have the file included twice? One thing to try is in the functions.php file line:13 change function name to SEMDBConnect2 and then change the function call on line:28 to the same thing. That was the only spot where it's called. It's worth a try.

Brendon Bauer
Jul 13, 2008, 01:55 AM
Well, I think that did work, however I've been chasing down too many of them. I've changed probably 25 instances of different functions that show up as errors. Every time I fix one, I get to a new one, and now I'm finally at some kind of error where I'm stuck. I guess I see why SEM is listed as for PHP 4 only. Well that kinda sucks. Oh well I guess. Any recommendations for some good event management software? It needs to blend into the website seamlessly.

Thanks for your help angelwatt! You always come to my rescue.

Jul 18, 2008, 10:41 PM
Just a shot in the dark...

When you include the SEM file, did you use include () or require ()?
If yes, try changing it to require_once ().

As mentioned by angelwatt, usually "Cannot redeclare" errors means that the function/method/class/etc is being declared twice. Most of the time it's due to the file that contains the function/method/class/etc being included twice.

Try checking where the file is being included from, and make sure they don't get included twice or more.


Jul 22, 2008, 10:47 AM
Just throwin' this out there...

PHP also has a nifty "function_exists('name_of_function')" used to determine if a function of that name exists or not, and if false you can create your own function. This can be used as an override if your software requires a function in PHP5 but someone is using PHP4 for example.

if (function_exists('imap_open')) {
echo "IMAP functions are available.<br />\n";
} else {
echo "IMAP functions are not available.<br />\n";