Page 1 of 1
switched servers -- a million bugs --
Posted: Mon Sep 12, 2011 2:58 pm
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?
Re: switched servers -- a million bugs --
Posted: Mon Sep 12, 2011 3:07 pm
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.
Re: switched servers -- a million bugs --
Posted: Mon Sep 12, 2011 3:40 pm
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
Re: switched servers -- a million bugs --
Posted: Mon Sep 12, 2011 5:21 pm
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
Re: switched servers -- a million bugs --
Posted: Mon Sep 12, 2011 5:38 pm
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.
Re: switched servers -- a million bugs --
Posted: Mon Sep 12, 2011 9:15 pm
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
Re: switched servers -- a million bugs --
Posted: Tue Sep 13, 2011 1:55 pm
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.
Re: switched servers -- a million bugs --
Posted: Thu Sep 22, 2011 6:01 pm
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.
Re: switched servers -- a million bugs --
Posted: Fri Sep 23, 2011 12:21 am
by twinedev
Well, again, without seeing the code that is submitting that query (and/or what builds it), kinda hard to say.
-Greg
Re: switched servers -- a million bugs --
Posted: Fri Sep 23, 2011 8:30 am
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.
Re: switched servers -- a million bugs --
Posted: Fri Sep 23, 2011 5:01 pm
by Mordred
-- Server version: 4.1.22
Looks like you've moved from mysql 4 to mysql 5.