473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Duplicated site not working from new db but does from old db

Hi,

There is a site running on a Windows 2000 server with mysql 4.0. It's been copied to a new server running Windows 2003 and mysql 4.1. The database has been copied in its entirety. When I modify the db config file to connect to the old Win 2000 site db, the new site runs fine. But when I change the config file to use the new db, the site doesn't work, I get a blank page and no source code. Any suggestions as to what might be happening?

Thanks in advance.
Jan 9 '09 #1
12 1910
Atli
5,058 Expert 4TB
Hi.

What language is your site written in?
You may have to turn on error messages to see what is going on.

Does the new server allow remote connections?
You need to make sure that the server itself allows remote access to port 3306 (unless you changed the MySQL port). If you server has a firewall, it is likely to block this by default.
And make sure the user you are using to connect to MySQL is allowed to connect remotely.
Jan 9 '09 #2
The site is in php. I turned error messages on and errors are logged, and I checked the log files and there are no messages. No errors display. I created a user with host set to Any Host. I already test the connection... if the db connection parameters are wrong I get an error message. So I know that site is connecting to the database. The db and site files are on the same server.
Jan 9 '09 #3
Atli
5,058 Expert 4TB
Ok.

Have you tried running some of the queries your site would run manually?
That would at least tell you if the database is working properly.

Could you show us the code that is connecting to the database?
If the database is working, and you can connect to it, then the problem could be with PHP rather than MySQL.
Jan 9 '09 #4
Well I created a page on the new site and wrote some code to pull a record from the new database and it worked fine.

How can the problem be PHP if when I change the db connection parameters in php file to connect to the old database at xxx.yy.xx.zz the site shows up. But when i change the xxx.yy.xx.zz to say "localhost" the site disappears. I've already used mysqldump to export and import the database to the new server.

I've been at this for months trying to figure out why this site doesn't work. Seems to be a new problem every week. Now I've been able to get it to work with the remote database, but not the local database.

Much appreciated.
Jan 9 '09 #5
Atli
5,058 Expert 4TB
Are there differences between the PHP versions, or the configuration, or anything else you can think of?

There are always subtle differences between versions, some of which have been known to cause problems when migrating sites from servers.
For example, sites that depended on the register_globals directive usually didn't work when moved from PHP4 to PHP5. PHP5 disabled that feature by default, while PHP4 had it enabled. (And they plan to remove that altogether in PHP6.)

There are a lot of configuration settings that can cause your site to act strangely, especially if you depend on features that are disabled by default. Like the short-tags syntax (<? .. ? rather than <?php .. ?>).

Given that you are just receiving a blank page, I would have thought you were receiving an error that is being suppressed. PHP usually doesn't fail without giving you a reason, unless the code is structure to do so.

Try adding this to the top of your page, before anything else:
Expand|Select|Wrap|Line Numbers
  1. error_reporting(E_ALL | E_STRICT);
  2. ini_set('display_errors', true);
If there are any errors, that should show them.
Not sure how you enabled the errors before, but this method should always work.
Jan 9 '09 #6
I think I may have found the problem. The old site running mysql 4.0 and phpmyadmin 2.6.0-pl1 will accept a query such as: "SELECT '*' FROM table WHERE 1" and return the entire table. But the new server running mysql 4.1 and phpmyadmin 2.6.0-pl3 returns an empty record set for "SELECT '*' FROM table WHERE 1".

It thinks the single quotes are around the asterisk is a field not just * to select all the fields.
Jan 9 '09 #7
Atli
5,058 Expert 4TB
Does that really work in MySQL4?

In MySQL5, any value that is quoted (with a few exceptions) are considered strings.
So the query you posted should print an asterisk for every row in the table.

Btw, the WHERE clause in that query is completely redundant.
Jan 9 '09 #8
I tested the query in the old database and it returns all the rows in the specified table. I know WHERE is redundant but the site was coded in such a weird way, and thats how the query is built in the code. so i need to test as it is. The new server returns an empty result with that query. I have no idea why mysql 4.0.20 and phpmyadmin 2.6.0-pl1 will accept a '*' as a * in the query. The single quotes are supposed to be the angled ones, at least thats what the query looks like and thats what I tested on both servers.
Jan 9 '09 #9
Atli
5,058 Expert 4TB
Ahh ok. That's a weird way to code.
I tested the `*` thing on 5.0 and 4.1 and both rejected it saying
ERROR 1054 (42S22): Unknown column '*' in 'field list'
Was going to test 4.0 to but it doesn't seem to be available for download anymore.

In any case.
I guess your going to have to either go through the code and rewrite the incorrect queries, or downgrade to 4.0 again :/
Jan 9 '09 #10
Yup. 4.0 is not available. So I had to debug the entire site to find where the `*` were used in queries and edit the code to remove the ` marks. And hazaah! Thank you very much for all your help. I don't think I would have spent the time to check the queries for compatibility. The site is up and running now.

Thanks again!
Jan 9 '09 #11
Atli
5,058 Expert 4TB
Glad you got it working.

Now you just need to upgrade to MySQL 5.1 and your all set for the next few years :]
Jan 9 '09 #12
r035198x
13,262 8TB
Just on that where. It might be useful in circumstances where you want the user to be able to specify a where clause. In that case the user only has to start with " and columnName = 'aValue' and " e.t.c without having to worry about whether to include the "where" or not as it's already been included.
Jan 9 '09 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mirek Rusin | last post by:
....what is the best way to force duplicated unique or primary key'ed row inserts not to raise errors? duplicated rows can be ignored or updated as well - it really doesn't matter. to be...
1
by: Iain | last post by:
I'm struggling to create a typed data set (with xsd.exe) with 4 tables and 3 layers orders -> Items Items->ItemAtts1 Items->ItemAtts2 if you follow me. it's kind of working, but I don't...
6
by: Niyazi | last post by:
Hi all, What is fastest way removing duplicated value from string array using vb.net? Here is what currently I am doing but the the array contains over 16000 items. And it just do it in 10 or...
2
by: orenlevy1 | last post by:
Hi Everyone. I have a problem that I could not figure out what to do with it. I have a couple of tables and views. All have the same unique ID. When a user try to do a search on our web site...
1
by: awrigley | last post by:
Hi An app that was chuntering away quite happily to itself had roles added to it. Just two: Admins and Subscribers. However, I seem to have mucked up when assigning the role provider in the...
6
by: Ryan Liu | last post by:
Hi, If I have tens of thousands DataRow in a DataTable and allow the end user to pick any DataColumn(s) to check for duplicated lines, the data is so large, is there a better API, algorithm can...
5
MattFitzgerald
by: MattFitzgerald | last post by:
Can you help I want to reduce the number of queries I use? I have a union query which combines data from 2 different databases located at different sites. Both databases are identical each of...
2
by: squiggly12 | last post by:
Hello all, I have this interesting problem and it has me scratching my head. I have updated a few forms to use CDOSYS to email instead of using the doCmd.SendObject. Dim objMessage As...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.