A short ToDo list for CodeIgniter deployment phase

CodeIgniter deployment issues


Codeigniter deployment


CodeIgniter is an open-source software rapid development web framework, for use in building dynamic websites with PHP. In this article you will find a short checklist that might help you to avoid the most common CodeIgniter deployment issues. Thank you for reading this!  


Codeigniter displays a blank page instead of error messages

This case could happen for many reasons: incorrect database credentials, no permission on system and application folders. To detect the root cause open index.php and edit the 'production' environment to display the errors:

ini_set('display_errors', 1); // default is ini_set('display_errors', 0);


Database wrong credentials

Open database.php and search visualize the values for the database, user and password. Be sure you're using the same values in cPanel database setup. 


Set log level 0 (Errors only) in production:

In development, usually, we are using a log level set on DEBUG (4). In production, you might face free space issues if your app logs too much information. When your account reaches the quota limit, your app could serve only 'blank screens' to the user. 


Remove index.php from CodeIgniter URLs. To achieve this edit or create a .htaccess file in your root folder. 

The magic directives are listed below. [ You may check out this production-ready htaccess sample ]

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?/$1 [L]


Basic SEO settings. 

[ To see a production-ready sample, you may check out this htAccess hosted on Github ]

Non-www to www Redirect (301). You need this redirect because Google save separate indexes for non-www and www URL's served by your domain. It's highly recommended to use this redirect

HTTP to HTTPS Redirect (301). Google, all mighty scores you better if your app is served on a secure connection. If you don't have a certificate to secure your app, just ignore this point.

Cache control:

# One month for most static assets

<filesMatch ".(css|jpg|jpeg|png|gif|js|ico|woff2)$">

Header set Cache-Control "max-age=31536000, public"

</filesMatch>


Related articles: Coded App in CodeIgniter - Argon Design System

For any questions & support, don't hesitate to contact us on Facebook.

Adi - Core AppSeed Team


Thank you!

home Home