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.

Implement Google Calendar in Your Website

Standard

For one of my project I need to implement Google Event Calendar in my CMS. First time I thought its may be complicated. But its not. See this:

Step1: First you need a Google service account. If you already have Google account for Gmail or any other Google service then you can use that account ID, in that case you do not need any new account.

Step2: Login to Google Calendar by this http://www.google.com/calendar

Step3: After login you will see a default event calendar according to your account ID. To navigate other or create a new calendar go to screen left side My Calendars Panel Box. For create new calendar, click on create. For navigate other calendar you have to click on any one from the list of all your calendars. From list select your preferred calendar. After select your preferred calendar navigate to the calendar settings by click on small array. After click on small array you will see a drop down list. Click on Calendar Settings. You will see your preferred calendar settings. Here also you will see a block with titled Embed This Calendar. Copy the iframe code from here and paste the code on you required CMS page. All done.
[Note: Dont forget to set you calendar public from calendar settings, to access the calendar without login.]

Status Code in HTTP, Internet Explorer Version

Standard

After two another post on this, I think I need to post an Internet Explorer Version of Status Code. See the followings:

52 Runtime Error
This is a “bad file name or number” error in JavaScript.

It means that the script cannot find a file it is looking for (web-page, course component) and is most likely a connectivity problem.

Try to clear your temporary internet files which should resolve any further problems… If this does not then speak with the website administrator as there may be a problem with the websites server.

400 Bad File Request
Usually means the syntax used in the url is incorrect (e.g. uppercase letter should be lowercase letter; wrong punctuation marks)

401 Unauthorised
The website server is looking for some encryption key(s) from the client (your computer) and is not getting it. Also, a wrong password may have been entered. Try it again, paying close attention to case sensitivity..

403 Forbidden/Access Denied
Similar to 401, special permission is needed to access the website A password and/or username may not be correctly registered on the websites database. Other times the website server may not have the proper permissions set up on its directories…

404 File Not Found
Server cannot find the file you requested. Refreshing the page (F5) should resolve this problem, although continued error messages may mean the page is no longer available, that there is considerable internet congestion (in which case the user should try again later).

Alternatively the file could have been either been moved or deleted, or you entered the wrong URL or document name. Look at the URL. If a word looks misspelled, correct it and try it again. If that doesn’t work backtrack by deleting information between each backslash, until you come to a page on that site that isn’t a 404.

From there you may be able to find the page you’re looking for. This has to be the most common Internet Explorer Error message on the Internet!

408 Request Timeout
Client (your computer) stopped the request before the server finished retrieving it. A user will either hit the stop button, close the browser, or click on a link before the page loads. Usually occurs when servers are slow or file sizes are large.

500 Internal Error

Couldn’t retrieve the HTML document because of server-configuration problems.

Contact website administrator…

501 Not Implemented
Web server doesn’t support a requested feature.

502 Service Temporarily Overloaded
Server congestion; too many connections; high traffic. Keep trying until the page loads. This can be a common occurrence at peak news times eg. the Twin Towers during September 2001 brought CNN and the BBC news sites to a slow crawl and many folks got this error.

503 Service Unavailable
Server busy, site may have moved, or you lost your dial-up Internet connection!

Bad File Request
Browser may not support the form or other coding you’re trying to access.

Connection Refused by Host
Either you do not have permission to access the site or your password is incorrect. Try again!

Errors on Page
This error message is a catch-all statement meaning there is something on the web page that the browser either hasn’t read properly (connectivity problem) or there are missing items in the web page itself. This problem normally affects the graphics on a web page.

This can be a temporary glitch (caused by insufficient bandwidth), and may be quickly resolved, or it can have a more complex and longer term problem. With regard to most cases of this Internet Explorer Error message, it is due to not having given sufficient time to download the page you are requesting.

It is necessary to wait until the bottom left hand corner of the page reads ‘done’ before selecting any other links on the page to move forward.

Failed DNS Lookup
The Domain Name Server can’t translate your domain request into a valid Internet address. The website server may be busy or down, or incorrect url (web address) was entered.

File Contains No Data
Page is there but is not showing anything. Error occurs in the document. Attributed to bad table formatting, or stripped header information….

Host Unavailable
Host server down. Hit reload or go to the site later

Network Connection Refused by the Server
The Web server is busy. To resolve this problem, refresh the page. (Press Ctrl and F5).

Runtime Error
(The information in this solution applies to: Internet Explorer 5.5 (SP1) 95 / 98 / 98 Second Edition / NT4.0 / 2000). When you attempt to browse to various websites, you may receive an error message similar to the following ‘A runtime error has occurred. Do you wish to debug? Line number Error: Permission Denied.’

This can occur if you upgrade to IE 5.5 (SP1). The upgrade enables the script-debugging and script-error-notification options. (Note: Because there are several versions of Windows, the following steps may be different on your computer. If they are, please consult your product documentation to complete these steps:)

To resolve this issue, disable the script-debugging and script-error-notification options. To do this, follow these steps:

1. Start Internet Explorer.
2. On the Tools menu, click Internet Options.
3. Click the Advanced tab .
4. Click to select the Disable script debugging check box .
5. Click to clear the Display a notification about every script error check box .
6. Click Apply, and then click OK.
Fortunately this is a very rare Internet Explorer Error message…

Script Error
Script errors are caused when something goes wrong when surfing some web pages. It is caused by VBScript or JavaScript code that is embedded within certain web pages. These errors are mostly due to connectivity problems, though can occasionally be caused by browser incompatibilities. Ensure that you have a compatible browser version (IE 5.5 and above or Netscape 4.76 and above).

Unable to Locate Host
Host server is down, Internet connection is lost, or URL typed incorrectly.

If refreshing the page doesn’t work, try clearing the Temporary Internet Files and History and refreshing again. You may have to wait until later.

Status Code in HTTP, Also known as Browser error Code – 2

Standard

This is second post on Status Code. I have another one post on this, see this

Followings are codes and their details :

Success 2xx
These codes indicate success. The body section if present is the object returned by the request. It is a MIME format object. It is in MIME format, and may only be in text/plain, text/html or one fo the formats specified as acceptable in the request.

OK 200
The request was fulfilled.

CREATED 201
Following a POST command, this indicates success, but the textual part of the response line indicates the URI by which the newly created document should be known.

Accepted 202
The request has been accepted for processing, but the processing has not been completed. The request may or may not eventually be acted upon, as it may be disallowed when processing actually takes place. there is no facility for status returns from asynchronous operations such as this.

Partial Information 203
When received in the response to a GET command, this indicates that the returned metainformation is not a definitive set of the object from a server with a copy of the object, but is from a private overlaid web. This may include annotation information about the object, for example.

No Response 204
Server has received the request but there is no information to send back, and the client should stay in the same document view. This is mainly to allow input for scripts without changing the document at the same time.

Error 4xx, 5xx
The 4xx codes are intended for cases in which the client seems to have erred, and the 5xx codes for the cases in which the server is aware that the server has erred. It is impossible to distinguish these cases in general, so the difference is only informational.

The body section may contain a document describing the error in human readable form. The document is in MIME format, and may only be in text/plain, text/html or one for the formats specified as acceptable in the request.

Bad request 400
The request had bad syntax or was inherently impossible to be satisfied.

Unauthorized 401
The parameter to this message gives a specification of authorization schemes which are acceptable. The client should retry the request with a suitable Authorization header.

PaymentRequired 402
The parameter to this message gives a specification of charging schemes acceptable. The client may retry the request with a suitable ChargeTo header.

Forbidden 403
The request is for something forbidden. Authorization will not help.

Not found 404
The server has not found anything matching the URI given

Internal Error 500
The server encountered an unexpected condition which prevented it from fulfilling the request.

Not implemented 501
The server does not support the facility required.

Service temporarily overloaded 502 (TO BE DISCUSSED)
The server cannot process the request due to a high load (whether HTTP servicing or other requests). The implication is that this is a temporary condition which maybe alleviated at other times.

Gateway timeout 503 (TO BE DISCUSSED)
This is equivalent to Internal Error 500, but in the case of a server which is in turn accessing some other service, this indicates that the respose from the other service did not return within a time that the gateway was prepared to wait. As from the point of view of the clientand the HTTP transaction the other service is hidden within the server, this maybe treated identically to Internal error 500, but has more diagnostic value.

Note: The 502 and 503 codes are new and for discussion, September 19, 1994

Redirection 3xx
The codes in this section indicate action to be taken (normally automatically) by the client in order to fulfill the request.

Moved 301
The data requested has been assigned a new URI, the change is permanent. (N.B. this is an optimisation, which must, pragmatically, be included in this definition. Browsers with link editing capabiliy should automatically relink to the new reference, where possible)

The response contains one or more header lines of the form

URI: String CrLf

Which specify alternative addresses for the object in question. The String is an optional comment field. If the response is to indicate a set of variants which each correspond to the requested URI, then the multipart/alternative wrapping may be used to distinguish different sets

Found 302
The data requested actually resides under a different URL, however, the redirection may be altered on occasion (when making links to these kinds of document, the browser should default to using the Udi of the redirection document, but have the option of linking to the final document) as for “Forward”.

The response format is the same as for Moved .

Method 303
Method:
body-section

Note: This status code is to be specified in more detail. For the moment it is for discussion only.

Like the found response, this suggests that the client go try another network address. In this case, a different method may be used too, rather than GET.

The body-section contains the parameters to be used for the method. This allows a document to be a pointer to a complex query operation.

The body may be preceded by the following additional fields as listed.

Not Modified 304
If the client has done a conditional GET and access is allowed, but the document has not been modified since the date and time specified in If-Modified-Since field, the server responds with a 304 status code and does not send the document body to the client.

Response headers are as if the client had sent a HEAD request, but limited to only those headers which make sense in this context. This means only headers that are relevant to cache managers and which may have changed independently of the document’s Last-Modified date. Examples include Date , Server and Expires .

The purpose of this feature is to allow efficient updates of local cache information (including relevant metainformation) without requiring the overhead of multiple HTTP requests (e.g. a HEAD followed by a GET) and minimizing the transmittal of information already known by the requesting client (usually a caching proxy).