Thursday 19 April 2018

PHP codeigniter status code in not working

While making project in Codeigniter framework many developers face these problems:
  • php http_response_code not working 
  • Http response code always returns 200
  • php http_response_code not working when hosting a linux server
  • 404 page not found in not working
  • php 500 not working in codeigniter
  • header already sent error in php
  • warning cannot modify header information headers already sent by (output started xyz.php line no...

All these problems occur when you host your website at Linux server that you have developed in codeigniter framework. 

You have to modify index.php file which is in the root directory of Codeigniter framework.

Step 1) Add ob_start(); function at the beginning of index.php after <?php

This function will turn on the output buffering. so that http response code works correctly. 

Step 2) define('ENVIRONMENT','development');

The modified index.php file is as


Thanks for sharing your valuable time.......

1 comment: