Jump to content
Larry Ullman's Book Forums

Uploading Website From Local Environment To Web Hosting


Recommended Posts

Hi,

 

After following Larry's book and getting the helps from this forum, I finally get my first web project done. It has 4k product items and 1.5k users in the database. The website is fully functional in localhost. I carefully checked and killed all of bugs.  Seems everything running without problem. 

 

So I need to looking into how to upload this project to the web host. I have never done anything like that before, so I am not sure what thing will go wrong and what things will screw up the project I have spent a year into.  Please give some idea of what to avoid.

 

I assume I just export the sql file from my local database and import it into web database with same name, and straightly upload all file in local host into web host. Change the BASE_URL value  to web URL, and that will be all I need to do? 

 

 

Link to comment
Share on other sites

Yes, uploading the database is fairly straightforward. Sometimes, importing the SQL file can be weird, but I've always seemed to have had success by simply copying all the code in the SQL file and then pasting it into an SQL statement prompt.

 

As you mentioned, the biggest issues often are related to file paths and how those might change with the new environment. Unfortunately, it's hard to really state what all needs to be done. Usually, the best way to learn is to simply try to migrate the site over, see what errors you encounter, and then do whatever is necessary in the future to prevent similar errors.

 

As a general statement though, anything that is dependent on the environment should always be stored in a central config file. By doing that, if an error occurs when you migrate the environment, making a single change to the config file should fix everything.

 

Anyway, beyond that, I can't offer much advice. A lot of migrating an environment is simply doing it and learning from your mistakes.

Good luck.

  • Upvote 2
Link to comment
Share on other sites

Aside from the db and file paths that HartleySan talks about, and testing it yourself as you go, just remember that the ultimate fail-safe is to have a backup of all your files and tables. Not just on your main hard drive but also on an external drive.. After putting in a year of work, I'd immediately get a safe copy offsite somewhere as a fallback. Nothing really bad can happen if you do this. You will then have three copies counting the one on your host.

 

If you're new at developing locally and moving to a host, I suggest that you watch out for the urge to fix small bugs by going directly to the host site (ftp) and doing it. Inevitably, you will forget to reconcile localhost and the two sites will be different which will get you into trouble later on.

 

One of your files is probably the one that contains the information to log into your database (mysql.in.php) or something like this. You might have developed that locally as being on the same level as your other files but is often kept in a safer location a level above the public Html of "root" directory on a host site. That's one path you might have to fix.

 

good luck

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...