Somegirlwitha.com

More geeky than girly.

Speed Up WordPress by Compressing Output

I’ve used dreamhost to host this website for years, but for some reason, wordpress runs extremely slowly on it. But I found some code to compress your php so I’m giving it a try. Does my page load a faster? Seems so to me, but maybe it’s just psychological.

First, place the following code in a file and call it “test.php” and then upload it to the root of your blog directory:

<?php phpinfo(); ?>

Make sure that “zlib” is enabled by your hosting provider.

Second, place the following code in your header (above the DOCTYPE):

<?php
ini_set('zlib.output_compression', 'On');
ini_set('zlib.output_compression_level', '1');
?>

If all’s well, make sure to delete that test.php file.

High five to wprecipes.com.

Talk to me, Goose.

This site uses Akismet to reduce spam. Learn how your comment data is processed.