switched servers -- a million bugs --

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

switched servers -- a million bugs --

Post by inosent1 »

hi

i was working on server A for ~3 years and the php / MySQL code worked fine

i exported all the tables uncompressed as is using the export command from phpadmin

i made no changes to the tables

i uploaded all the php files exactly as they were on the other server

but now i get a constant stream of error messages i never saw before
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in ... on line ...
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in ... on line ...
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in ... on line ...
Warning: mktime() expects parameter 4 to be long, string given in ... on line ...
Warning: Cannot modify header information - headers already sent by ... on line ...

why is it that using a different server with no modification to code or tables causes so many bugs?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: switched servers -- a million bugs --

Post by Christopher »

Probably they have different version of PHP. What is the version of PHP on the old and new servers? It also looks like you might not be getting a database connection.
(#10850)
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

Re: switched servers -- a million bugs --

Post by inosent1 »

from the tables i saved before the server went down
-- phpMyAdmin SQL Dump
-- version 2.11.11.3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 09, 2011 at 03:25 PM
-- Server version: 4.1.22
-- PHP Version: 5.2.6
from the new server
Apache version 2.2.19
PHP version 5.3.6
MySQL version 5.0.92-community-log
Architecture x86_64
Operating system linux
Shared IP Address 50.23.98.194
Path to sendmail /usr/sbin/sendmail
Path to Perl /usr/bin/perl
Perl version 5.8.8
Kernel version 2.6.18-238.9.1.el5
cPanel Pro 1.0 (RC1)
and from an exported sql table, the top of the file says ...
-- phpMyAdmin SQL Dump
-- version 3.4.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 12, 2011 at 03:38 PM
-- Server version: 5.0.92
-- PHP Version: 5.2.6
i know it connects with the DB ... well, at least several of the tables ... because the search function, file retrieval, and log in areas seem to work.

it looks like the versions are different, but i dont know what the nuances are
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: switched servers -- a million bugs --

Post by twinedev »

It could be that you were getting all those warnings before, but just the error reporting level on old server was set to not actually display them to the output.

Warnings will let the program conintue, Errors stop the program.

So, other than all the warnings displaying, does the site seem to be functioning (granted, any header() use will fail if a warning was sent out before it is called, as you cannot have any output before a call to header()).

IMO, do NOT just turn off displaying of the errors. fix the code to be proper. This will help for future upgrades to PHP. I feel a site should not go live without error_log being tailed as you do a final run through of EVERYTHING. Some people don't pay attention to this, and unknown to them, they are generating HUGE error logs on the server, because on the browser it all "looks" right. (Seen one site that every freaking call to their home page, kid you not, generated 2MEGS of error output to the error log)

-Greg
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

Re: switched servers -- a million bugs --

Post by inosent1 »

thanks for the reply

the error log goes back to May 2009 and it is 97KB (small). the last entry was 6 months ago (one line) and then before that May 2009 when the program was first being developed.

and the prog doesnt seem to run in a a few key ways. like it prevents me from navigating to certain pages when before i did not have that issue.

i keep thinking it is an issue with the difference in PHP server versions, etc.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: switched servers -- a million bugs --

Post by twinedev »

can you post the code that is generating the warnings above? without that, it is hard to say. There are function that depreciate between versions, without seeing the code itself, would be hard to let you know further.

-Greg
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: switched servers -- a million bugs --

Post by John Cartwright »

It sounds like you do not have proper error checking on your queries. You are assuming they were run successfully and/or returning data. Implement conditional checks on the query and apply mysql_error() where appropriate.
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

Re: switched servers -- a million bugs --

Post by inosent1 »

thanks for the reply

i was able to fix a few things using the error checking noted above, but i am still mystified by a few issues

here's one

Code: Select all

Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group by(ut.user_type_id)' at line 1 Actual query: 
as i mentioned, the error log was practically empty, and now i see lots of little things like this. this error pops up when i try to log out.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: switched servers -- a million bugs --

Post by twinedev »

Well, again, without seeing the code that is submitting that query (and/or what builds it), kinda hard to say.

-Greg
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: switched servers -- a million bugs --

Post by John Cartwright »

twinedev wrote:Well, again, without seeing the code that is submitting that query (and/or what builds it), kinda hard to say.

-Greg
Indeed. Include the entire SQL in your error reporting functions to help replicate the issue.
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: switched servers -- a million bugs --

Post by Mordred »

-- Server version: 4.1.22
Looks like you've moved from mysql 4 to mysql 5.
Post Reply