How to Speed Up CodeIgniter

Simple steps to speed up your CodeIgniter applications. HTML, Page Caching and Gzip.

1. Compress HTML output

We will need to create a hook. This hook will remove any whitespace in the HTML output.

Go to system/application/config/config.php and enable hooks:

Go to system/application/config/hooks.php and add the new hook:

Create the file system/application/hooks/compress.php and add the following code:

IMPORTANT: if you have any JavaScript within the HTML (not in a .JS file) make sure you don’t have JavaScripts comments in it.

Use the PHP comment system instead:

2. Cache functions

You can cache certain functions in your controllers.

Add the following line and it will create a cached HTML of the page.

Make sure the Application/cache folder is writable.

3. Enable Gzip Compression

Go to application/config/config.php and enable the Gzip compression:

(Visited 80 times, 1 visits today)

Comments

comments

Leave a Reply