Kiran's blog

Different Error Levels in PHP

PHP errors are categorized by an error level ranging from notices to fatal errors. The error level tells you how serious the error is.Most errors may be caught with a custom error handler, but some are unrecoverable.

E_ERROR
This is a fatal, unrecoverable error. Examples are out-of-memory errors, uncaught exceptions, or class redeclarations.
E_WARNING
This is the most common type of error. It normally signals that something you tried doing went wrong. Typical examples are missing function parameters, a database you could not connect to, or division by zero.
E_PARSE
Parse errors occur during compilation, and force PHP to abort before execution. This means that if a file fails with a parse error, none of it will be executed.
E_STRICT
This error level is the only one not included in the E_ALL constant. The reason for this is to make transition from PHP 4 to PHP 5 easier; you can still
run PHP 4 code in PHP 5.
E_NOTICE

Runtime Errors In PHP

Once code is up and running, non-fatal runtime errors are the most common type of error in PHP. Runtime refers to errors that occur during execution of the code, which are not usually programming errors but caused factors outside PHP itself, such as disk or network operations or database calls.

PHP has an error-reporting mechanism that is used for all errors triggered inside PHP itself, either during compilation of the script or when executing a built-in function. You can use this error-reporting mechanism from a script as well, although there are more powerful ways of reporting errors (such as exceptions).

Even perfectly good code may produce runtime errors, so everyone has to deal with them in one way or another.

SAPI Differences PHP configuration

PHP is not only available for many different operating systems, but it also offers native interfaces to a range of different Server APIs, or SAPIs in PHP lingo. The most common PHP SAPI is the Apache 1.3 module; others are CGI, CLI, the IIS filter, the embeddable version of PHP,and so on.

Some SAPIs offer PHP functions that are available only in that SAPI.
For example, the Apache 1.3 SAPI offers a function called apache_note() to
pass information to other Apache modules.

Table below shows some SAPI-specific functions.

Function SAPI Layers that Define It
ApacheRequest (class) apache_hooks
apache_lookup_uri apache, apache_hooks, apache2filter
apache_request_headers apache, apache_hooks, apache2filter
apache_response_headers apache, apache_hooks, apache2filter

DB Error Codes

Each database driver converts the error codes or error messages from the DBMS to a DB error code. These codes are represented as PHP constants. Here is a list of supported error codes given by examples of situations that causes them:

☞ DB_ERROR_ACCESS_VIOLATION. Missing privileges for a table, no read access
to file referenced by opaque parameters, or bad username or password.
☞ DB_ERROR_ALREADY_EXISTS. Table, sequence, procedure, view, trigger, or some
other condition already exists.
☞ DB_ERROR_CANNOT_CREATE. Cannot create table or file; the cause of problem
is outside the DBMS.
☞ DB_ERROR_CANNOT_DROP. Cannot drop table or delete file; the cause of problem
is outside the DBMS.
☞ DB_ERROR_CONNECT_FAILED. Could not establish database connection.
☞ DB_ERROR_CONSTRAINT. Foreign key does not exist, row contains foreign key
referenced by another table, and field constraints violated.
☞ DB_ERROR_CONSTRAINT_NOT_NULL. Field may not be NULL.

Understanding MIME type

MIME stands for "Multimedia Internet Mail Extensions." MIME was originally invented for describing the content of email.

"MIME types" are generally used for identifying the type of information in a file. While the file extension .htm is not formally understood to mean that the file is an HTML page, there is no requirement that it mean this, and many HTML pages have different file extensions.

In case of HTTP protocol used in web browsers for communicating with web servers, the "file extension" of the URL are really not used to determine the type of information that the server will return. In some cases, there may be no file extension at all at the end of the URL.

So the web server in terms specifies the correct MIME type using a Content-type: header while responding to the web browser's HTTP request.

Some common MIME type are as follows:

Type Common File Extension Purpose

Cumulus Tag Cloud

Kiran Says

I love work environment which is:

Informal yet professional
Demanding yet rewarding
Challenging yet inspiring
Mediocrity is not an option
Having fun is serious business
Making mistakes is human
Forgiveness is Company Policy

Travelling Sucks