MySQL & PHP powering 2 websites

GeekDrew

Diamond Member
Jun 7, 2000
9,099
19
81
I wrote a registration portal for a company earlier this year... it's powered by PHP & MySQL. Tonight, I became aware that I needed to copy the files and the database exactly as they were, to a new website, for another company. No big deal, right?

I created a tar of the files from the origin website, sent it over to the destination account, and untarred the files.

I created a new database for the new site. We'll call the old database "registration", and the new database "auction". After I created the database, I needed some way to get the data from one database into the other... the easiest way I could think of doing that was to run mysqldump on "registration" to pipe the database into an SQL dump file, and then I ran mysql on "auction", piping the registration.sql dump file back into it, to create an identical database... the only difference should be the database name.

I then modified the files in the "auction" account, so that they reflected the new database name and password.

I check phpMyAdmin, and everything appears sound.

So, I started using the "auction" site, making the customizations that it needs. An hour or so later, I went back to the "registration" site, and realized that the changes I was making on the new site are also happening on the old site... meaning that the new site is still using the old database. After smacking myself in the forehead, I loaded the database connection script, to fix it... thinking that I had just forgotten to set the correct database name & password, or had forgotten to save the changes. Nope! The changes were there, and they were correct. I have a debug script on those sites that echoes back the MySQL connection properties (including the database name, username, and password)... the new site reflected that it was using the new site's database, user, and pass, and the old site reflected that it was using the old site's database, user, and pass. Yet that's not possible, because the changes are happening on both sites at the same time.

I opened all of the files in the new site's folder, and searched them for the username and database name of the old site... they did not exist.

I opened all of the files in the old site's folder, and searched them for the username and database name of the new site... they also did not exist.

I'm rather stumped as to what on earth I did wrong, or what is causing the error. :Q

Any ideas?
 

GeekDrew

Diamond Member
Jun 7, 2000
9,099
19
81
Originally posted by: nsafreak
Did you remember to reconfigure the hostname?

The hostname remained the same.

But... heh... my problem disappeared as quickly as it appeared. Now I'm not having any problems at all... and I did not modify my connection parameters. :confused:
 

GeekDrew

Diamond Member
Jun 7, 2000
9,099
19
81
Originally posted by: GeekDrew
But... heh... my problem disappeared as quickly as it appeared. Now I'm not having any problems at all... and I did not modify my connection parameters. :confused:

Scratch that. Maybe I am still having the problems.

phpMyAdmin and my website are both connecting to the database, and are reflecting the data I am expecting. But when I SSH in, and run mysqldump on the correct database, after triple checking the parameters I'm passing to it, I'm getting the data from the wrong database. :confused:
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Restart apache on the new box. I don't know much about PHP, but it sounds like something you get when you modify a module in modperl - the old one is cached, and you won't see the changes until you restart the server to load the new stuff.

edit - just read your last post again, about having issues via SSH now?! I suggest you slow down, and think things through thoroughly and make sure you really understand what you're doing :p
 

GeekDrew

Diamond Member
Jun 7, 2000
9,099
19
81
Originally posted by: Armitage
Restart apache on the new box. I don't know much about PHP, but it sounds like something you get when you modify a module in modperl - the old one is cached, and you won't see the changes until you restart the server to load the new stuff.

edit - just read your last post again, about having issues via SSH now?! I suggest you slow down, and think things through thoroughly and make sure you really understand what you're doing :p

Thanks for your vote of confidance, pal. :| I know exactly what I'm doing... I've done this thousands of times, and never encountered a problem such as this.

All of the commands that I was issuing via SSH were built by a script, and then double checked by myself - and I was still getting unreliable data from MySQL.

The old and new sites were hosted on the same machine, just in different user accounts... not that it should matter at all.

Now, everything appears to be working just fine. :confused:
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Originally posted by: GeekDrew
Originally posted by: Armitage
Restart apache on the new box. I don't know much about PHP, but it sounds like something you get when you modify a module in modperl - the old one is cached, and you won't see the changes until you restart the server to load the new stuff.

edit - just read your last post again, about having issues via SSH now?! I suggest you slow down, and think things through thoroughly and make sure you really understand what you're doing :p

Thanks for your vote of confidance, pal. :| I know exactly what I'm doing... I've done this thousands of times, and never encountered a problem such as this.

Eh? Relax - It's not a slam on you. It just sounds like the kind of situation I find myself in occasionally. I think I know exactly what I'm doing but inexplicable things happen anyway. When that happens I find it's best to step back and look at the big picture, and reaxamine everything I think I'm doing, check all the things I think I've done, etc.

All of the commands that I was issuing via SSH were built by a script, and then double checked by myself - and I was still getting unreliable data from MySQL.

The old and new sites were hosted on the same machine, just in different user accounts... not that it should matter at all.

Now, everything appears to be working just fine. :confused: