Hosting Switch Complete!
The switch to the new host is complete, and things should be rather transparent. I've sped the site up a bit, as well as converted all the pages to PHP. This lets me do more includes, and involve little random content here and there. The include system is more powerful than SSI, as well.
Also, as I was hipped to by Josh, this site is now compressed in gzip format prior to being sent out to you. That means the pages are about 30% the size that they were originally! There is a slight server overhead involved, but so what, I'm paying for their server time, so by god I'm gonna use it! Besides, its not like this site is getting thousands of hits per hour or anything. If you want to do this too, then you can! The only qualifications is that your server has PHP version 4.1 or better, and your pages are parsed by PHP. Most servers these days have a new enough version, and if your pages end in .php, then that means they are being parsed by PHP. If that is the case for your page, check out this link on Textism on how to set up compression. Its very easy, only one line of PHP needed.
If your site isn't being parsed by PHP, because the extension is something 'normal' like .html or .shtml or .htm, and you are running the Apache web server, then here is a trick you can do to make your site parsed by PHP. This will increase server load a little bit, because all your pages will be parsed, even if they don't have much php content, but if you want to compress them all, or use some of php's other super-cool features, then its worth it.
Create a .htaccess file in the root directory of your webspace. If there is already a .htaccess file there, then we'll just use it, leave anything else in there thats already there. .htaccess files allow you to override the Apache server settings to your specific needs. Most web servers allow .htaccess files, but some do not, so if this doesn't work, then talk to your administrator.
In the .htaccess file, put a line like this:
AddType application/x-httpd-php .htmlThis will make Apache use the x-httpd-php application to parse anything that ends with .html! Your .html files have now become php files, but you didn't have to go through and change all your links and filenames to .php! If you are using .shtml, like me, then you need to make two changes. First, simply change .html in the above example to .shtml, thats pretty obvious. The second is you need to add the following line ABOVE the line we specified above:
RemoveHandler .shtmlThis line will make Apache NOT try to server-parse the .shtml files. .shtml files are usually used when you are using Server Side Includes to add things to your pages. A page cannot be parsed by both PHP and the server for SSI calls! You'll need to remove any SSI you have in your page, and replace it with equivalent PHP. If you are just using the SSI include virtual call, then you can easily replace it with:
<?php include("filename.txt"); ?>
Pretty much anything you can do with SSIs, you can also do with PHP, so if you have a lot of complex stuff in there, you may need to do some research to figure out the best PHP way to do it.
Anyway, this is how my page is now PHP, yet is claiming to be .shtml. Through the magic of .htaccess and server-side scripting! Yay!
However, my elation is softened in the realization that despite all the momentous changes none of you will notice a functional difference in the page, except that it will load faster. Lucky you. If you don't mind, just be a little bit proud of me, that I did all that codey stuff just for you!
2 comments Sunday 08 Dec 2002 | Sam | Metacrap
2 Responses to “Hosting Switch Complete!”
All apologies, if spam please delete
wow its been quite a coincidental day. I just had help turning my computer into a server. This guy helped me install apache, php, mysql, tomcat and more or less taught me to do many of the things that you were talking about in your post. what an odd coincidence. an even greater coincidence is that he knows you! his name is jessie and he almost moved into the factory but kier blocked him (for anyone who is curious sam and I once lived in an old incense factory). An Even greater coincidence than that is the fact that my current desk was once his desk! I claimed the green topped drafting table that was abandoned at the factory. He identified because he was visiting my roommate!
He runs a small company and offered me a job helping him with the design end of embedding php into flash and embedding html into jsp.
there are some people who call coincidences god winks, they think its somethings little way of letting you know how the universe is organized.
then there are some existentialists like camus who believe the universe is a big whirling random mass of completely unorganized stuff.
Theres this saying ?civilization is just chaos taking a rest?. I have this friend christ who thinks the saying is bunk. She says that civilization embodies chaos more than nature, which she thinks operates off of a very clear set of principles.
I think this kinda stuff is interesting, but im a geek.