Rebuilding website from root dump

Soldato
Joined
8 Nov 2005
Posts
4,483
A friend of mine has had a little falling-out with the small-time media 'agency' he has been employing to design and host his company's website (the short version is they were falling well short of their SLA's and they threw their toys out of the pram over it) and has been given a 'dump' of the site as it last stood and told to 'do it himself' if he doesn't like things as they are/were.

I've got a hosting package it could sit on for the time being, and I'm in the process of getting the domain under my control and pointing everything in the right direction, but I'm utterly baffled with the files for the website itself.

I've got two folders in a .zip that the previous 'hosts' have sent through; one contains all the website files and the other seems to be the SQL database that tied it all together.

The problem I have is that I have no idea how to get the website back up-and-running again with what I've got to hand. I can get the website structure online easy enough, but how do I tie the SQL database in with that?

Is that even possible? And if so, how?
 
You would need to create a MySQL database, import the SQL file that they gave you and then modify the config file in the code to make it point at your database.

Without knowing/seeing the code it's difficult to tell you exactly what needs to happen.
 
Okay, that sounds relatively straightforward. Well, I understand what you mean anyway - the actual doing might prove my downfall.

When you mention this config file, would that be in the website files themselves? As in some of the pages would be coded to point to one location and I'll need to change that line of code to point to the new one?

As it currently stands, the website is relatively simplistic in its structure. It looks like the SQL database was used to generate the product pages and handle the various customer logins used to browse the products.
 
Yes, what language is it in? Is it a bunch of PHP files, ASP files, something else?

The file that points to the MySQL database will generally contain: hostname, username, database name, password. You just need to make sure those four values point to your databse.
 
Everything seems to be written in PHP.

I can see from one of the pages (showproductrange.php) that it references a connect.php file for the SQL database. And looking at that file, that shows the various paramaters for the database itself - db_host, db_name, username, password, etc.

So, I guess it's that connect.php file that I'll need to fiddle about with in order to get everything talking to each other?

And with the database itself, I'm in my cPanel and I can see where to create a new MySQL database, but where do I go from there? I guess I'll need to change the code in connect.php to reflect the new database name, username and password that I create, but how do I get the content of the old one into the new one?
 
Okay, I think I've figured at least part of it out by using parts of my brain that I thought were long lost.

First off I've created a new database and a new user and then married the two together - although I have no idea what permissions to give said user.

Once the database has been created, I've headed into the phpMyAdmin area and imported the data from the old SQL database into the new one - I think.

And then I've amended the connect.php file with the new information, which I presume just needs to be uploaded to the right place on the server and then wait for the magic to happen.

Am barking up the right tree?
 
connect.php sounds right. You will need to adjust the values in there.

connect.php will just need to be overwritten on the server, so find the one that's already uploaded and upload your modified one over the top.

Give the user full permissions to that MySQL database.

I would suggest keeping an original copy of the website files somewhere until you have it working, just in case something goes wrong.
 
The simple solution: Upload the PHP files to your new host, and also upload the SQL file/zip. Then contact your host and they will setup the database and connect it with your site.

Any decent host will have this sorted in a matter of minutes for you. If they won't/cant it's time to get a new host.
 
The simple solution: Upload the PHP files to your new host, and also upload the SQL file/zip. Then contact your host and they will setup the database and connect it with your site.

Any decent host will have this sorted in a matter of minutes for you. If they won't/cant it's time to get a new host.

That's a bit harsh considering you're paying them for hosting, not for maintaining your site. That said, if you're paying them enough, most of them will bend over backwards for you.


@OP

Craig already gave you the answer though, import your SQL dump, update the configuration file. I'd then update my etc/hosts in order to reflect the url on the new server and check if the site is working correctly. Then you update the dns to point to your new server.

Assuming they gave you everything, and the people who coded it done a decent job, it'll just work.

In any event, no offense intended, if the site is of any importance, he'd have been better off paying someone who knows what they're doing.
 
That's a bit harsh considering you're paying them for hosting, not for maintaining your site. That said, if you're paying them enough, most of them will bend over backwards for you.

It will take them a minute, and they will be happy to do it. It's not 'harsh' at all. You're not just paying for hosting, you're purchasing customer support as well.

Professional hosting companies won't have the slightest problem with such a request. Of course if you're paying some 14 year old kid to host your website then it's a different matter.

Also, how much you're paying shouldn't come into the equation, as reputation is everything to them. So even their lowest paying customers will still be given the same support as people with more expensive packages.
 
Last edited:
It will take them a minute, and they will be happy to do it. It's not 'harsh' at all. You're not just paying for hosting, you're purchasing customer support as well.

Customer support pertaining to the hosting, not customer support pertaining to your code. Some companies may offer further levels of support, but that doesn't mean the no-frills hosting company with a better infrastructure and more knowledgeable administrators are bad at hosting just because they won't recode your site for you.

Furthermore, it's probably closer to a 10 minute fix if you count the time it takes them to:-

1)read the ticket
2)login
3)search the code
4)test that it's working correctly (which they don't REALLY know unless its common software)
5)respond to customer.

Times that by the 100000+ sites that a professional outfit is probably hosting, and you'll quickly understand they need to pay for that support in some way, and for £20 a year they aren't really charging you for it.

So I will reiterate, it is indeed harsh for you to call a hosting service less than decent based on the fact they don't do work which is not pertaining to hosting directly. Whilst you are well within your rights to host with businesses who offer more, either gratis, or for a fee, it doesn't mean all hosts which don't are crap.

Professional hosting companies won't have the slightest problem with such a request. Of course if you're paying some 14 year old kid to host your website then it's a different matter.

Professional hosting companies are more likely to draw the line on what they will, and will not support. They're more likely to understand the difference between an administrators job, and that of a developer, and that whilst a reasonably developed system should be easy to migrate, they'll be hosting tens of thousands of crapware that they simply don't want to be involved with on a code level.

Delving into someones code is a good way to make things worse and ruin an otherwise unblemished reputation, and isn't something every support monkey can, or should, be doing. Furthermore the line needs to be drawn somewhere, otherwise you get people coming back with a new "problem" every few hours until you've written their site for them. I'm betting you're drawing it after editing config files, but it's not uncommon for hosting companies to draw it at "your code is your problem".

Also, how much you're paying shouldn't come into the equation, as reputation is everything to them. So even their lowest paying customers will still be given the same support as people with more expensive packages.

It shouldn't, but it does. If you rent a dedicated server, you almost always get support from people who have some clue about what they're doing. If you buy some shared hosting, it's pretty much hit and miss and can be a god awful experience in the larger hosting companies. I guess they're not professional though, eh?
 
Last edited:
Okay, quick update with all of this.

I followed the steps I suggested in Post #6 and uploaded the updated connect.php file, but I'd obviously done something wrong along the line as I was getting various error messages on the pages that looked like this:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in

I assumed that I'd mucked up in importing the SQL database in some way as the code itself hadn't been changed, but while I could see what was on each of the lines the error messages were referring to, I had no idea what they meant!

So, having ran out of knowledge/luck I called in reinforcements in the shape of my hosts, as Van Hellseek had suggested. Admittedly I was a little cautious in doing this as I didn't really think this fell under their remit, but to my absolute astonishment they didn't bat an eyelid and had everything sorted out within a couple of hours of my original ticket being raised.

And they even managed to make a few other changes along the way that fixed a couple of other niggles that cropped up - and all without breaking a sweat and with the consumate professionalism that I've come to expect from them.

So, massive thanks to al the lovely people at Tsohost and thanks to the four people who posted in this thread and helped me along the way. I'm in your collective debt.
 
Back
Top Bottom