Being a Website Designer and Webmaster - Part Four
In the past posts, we have talked about what type of tools can help you out when you create a website. But there's something else you're going to have to think about, and this is called website maintenance. This can be a lot of work, but there's several things you can do to help out. More info after the break!
Why you need to maintain your website:
No matter what type of website you are running, you are going to have to clean it up some day. Your website can be messy internally. This means your database or even the scripts you use can be inefficient when it comes to accessing them. The folder structure of your website can be the messiest thing in the world. Let's say your working on a test project for your website, and there's several files you need to put on your server. You should create a folder like "Testing" or something like that where you are able to put all your projects in. You don't want to smack all of your files in the root directory (public_html or www; this is the main folder where your website sits on); it would get messy quickly. Your website will run slower if your scripts and even your database are messy and not cleaned up correctly.
How do you do all of this:
There's a lot of things you could do. But we're going to start off with the basics.
1) Clean up your source code (PHP, HTML, and CSS for example)
This might sound funny, but your scripts can slow down your website. The biggest thing is how fast the script can execute. If your script is running slowly, you might want to change your coding.
Another thing you can do is delete your blank chars (spaces before the code executed) and also your blank paragraphs. This might sound surprising, but it actually saves you some used space; in return, gives you faster loading times.
And you can try to lay up on your comments you have in your code. PHP does have to skip those comments. In other languages like C++ for example, when you compile your program, your comments are already stripped out from the program. In PHP and all types of scripts, this is not the case. So try to lay down on your internal comments. And yes, this does apply to CSS and HTML too!
Notepad++ can help you out...
2) Clean up your folder structure:
If you have a lot of folders, you might want to clean some of those up. Not for the case of slowing anything down, but mainly because it makes accessing your server via FTP or any other file transfer protocol easier.
3) Make sure your database (like MySQL) is clean:
What I mean by as clean might confuse people. But your database can get huge if you have a site that has a lot of content. Your database is like a hard drive, it can get fragmented, which slows it down in return. But there's an easy way to fix this. All you need to do is log into PHPMyAdmin (a software that manages your database), and click on a database/table that you think needs fixed up. First, click on a database you want to fix up. Then with the check boxes or the "Check All" at the bottom, select the tables you want to fix up. Then at the bottom of the page, you should see a drop-down box where it says "With selected:". Click "Optimize table" and then you should be able to go. If your database is in bad shape, you can also click "Repair table", which will try to fix corruption issues.
You can also create scripts to handle this. Remember, Google is your friend. You can search for "optimize MySQL database PHP", and I bet you'll find something! :)
4) Backup your site:
This is the most important part! If anything crashes or corrupts, you could be lost a couple of files. You should always backup your database no matter what! You don't always have to backup your files (unless if your content is stored in those PHP/HTML/CSS files), but it would be a good thing to think about. Personally, I backup my database every week, and I backup all my files every month. This is all managed by scripts. And about every 5 months or so, I store the backup on a terabyte hard drive I have. You always want to be safe.
A search with "backup files database PHP" on Google can help!
I hope some of these tips for cleaning and maintaining your website will help you out!
Stalk me on social media! Any other way would just be creepy…
Follow me: