A series solutions of Codeigniter version errors

Standard

In the article I am going to post some solutions of well-known Codeigniter errors. These errors list are here:

1. When you run an old codeigniter applications in new version localhost server (PHP5.x, MySQL5, Xampp7.2 ) it shows blank page known as white skin (?screen) of death.

2. Shows the error message “The URI you submitted has disallowed characters”

3. Shows the error message “Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\……….php on line ……”

If you see any of the errors, follow these steps one after another. May be it could help you to run your Codeigniter applications without errors.

Solutions:

First check is your Codeigniter version is new or old. To do this, go to ci_applicationname/system/codeigniter folder. Open CodeIgniter.php file. On the top of the file find-out these two lines:

// CI Version
define('CI_VERSION', '1.6.3');

If it shows older Codeigniter version then download a Latest Codeigniter from here.
What will you do now? Unzip the new CI version and go to system folder. In system folder copy codeigniter, database, helpers, language, libraries, scaffolding, plugins all these folder. Place/Paste these folders in your old Codeigniter application system folder. Please backup your old CI apps before do any change. Now again go to new version of Codeigniter, and go to system/application/config folder and copy the file constants.php file and paste it in your old Codeigniter application same directed folder. Now your CI version up-gradation done. Ok now going to solve some common problems.

Open the index.php file located in your application folder root. Find out this two line:
//error_reporting(E_ALL);
error_reporting(E_ERROR&~E_NOTICE);

Reverse the code, mean remove comment tag from first line and place comment tag in second line like followings:
error_reporting(E_ALL);
//error_reporting(E_ERROR&~E_NOTICE);

Now run your application on your localhost. It will show all error if any file/folder missing. Fix that by place those files/folders on that specified location from other running CI apps or from new CI version.

If you see this message “The URI you submitted has disallowed characters” do the followings:
Go to your application system/libraries and open the file URI.php. At line 189 or like something this you will see this:
if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
and replace that by this
if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
or by this
if ( ! preg_match("|^[".str_replace('\\-', '-', preg_quote ($this->config->item('permitted_uri_chars')))."]+$|i", $str))

And go to your application system/application/config folder and open config.php file and go to line 126 or something like that, you will see this $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-'; and replace this by $config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';

Now the error “The URI you submitted has disallowed characters” may be fixed.

Till your application show error? It may be look like this “Deprecated: Assigning the return value of new by reference is deprecated in ….php on line …”. What now? Yeah! I like to solve the bugs by dirty way. Again Open the index.php file located in your application folder root. Find out this two line:

error_reporting(E_ALL);
//error_reporting(E_ERROR&~E_NOTICE);

Now again reverse the code, mean remove comment tag from second line and place comment tag in first line like followings:
//error_reporting(E_ALL);
error_reporting(E_ERROR&~E_NOTICE);

Now go to http://localhost/your_apps and run apps. Hope all errors are fix now.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s