Codeigniter

Most Essential And Frequently Asked Interview Questions And Answer

Ans:

php.ini and .htaccess file

Both php.ini and .htaccess file is configuration file.

php.ini:

It is a configuration file for php setting. It is a special file by which you can make changes in PHP settings. php.ini file provide many setting such as changing of the default max_execution_time = 30, error_reporting = E_ALL & ~E_NOTICE, file_uploads = [on/off]  etc.

 

.htaccess:

It is configuration  file for server setting. With the help of .htaccess file you can make changes in server settings. It is supported by several web servers, including the popular Apache software which is used by most commercial web hosting providers. These files were first used to control user access on per-directory basis. It is used to control a couple of things such as error handling, enabling ssl, ip blocking and ip whitelisting, url redirect and url rewriting etc.

Ans:

Codeigniter | Set timezone

To set default timezone in Codeigniter, you can add the date_default_timezone_set() function in your application/config.php or index.php file.

date_default_timezone_set('your timezone');
View Detials
Ans:

Codeigniter | SET or GET config variables

The config set_item() & item() functions are work for SET and GET a config variable in codeigniter

View Detials
Ans:

Codeigniter | Include image, css and js file

In codeigniter, we need to load URL helper in controller and then use base_url() function to load the resources.

// loading script
<script type='text/javascript' src="<?php echo base_url('js/jquery.min.js'); ?>"></script>

// loading image
<img src="<?php echo site_url('images/myimage.jpg'); ?>" />
View Detials
Ans:

CodeIgniter | What is helpers | Load helper file

Helper is simply a collection of function in a particular category which help you with tasks. The helper file can be loaded in controller constructor, some specific function or in application/config/autoload.php file

Adding helper in controller:

$this->load->helper('name');
View Detials
Ans:

Access specifiers

An access specifier is a code element which is used to determine which part of the program is allowed to access a particular variable or other information.

View Detials
Ans:

Codeigniter | List Databases supported By Codeigniter

Following Databases are supported by Codeigniter Frameworks:

Database Name Drivers to support Codeigniter
MySQL MySQL (deprecated), MYSQLI and PDO drivers
Oracle oci8 and PDO drivers
PostgreSQL Postgre and PDO drivers
MS SQL MsSQL, Sqlsrv (version 2005 and above only) and PDO drivers
SQLite SQLite (version 2), sqlite3 (version 3) and PDO drivers
CUBRID Cubridand PDO drivers
Interbase/Firebird iBase and PDO drivers
ODBC

ODBC and PDO drivers

(you should know that ODBC is actually an abstraction layer)

 

Ans:

Cross-site scripting (XSS)

Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications. XSS enables attackers to inject client-side script into web pages viewed by other users. A cross-site scripting vulnerability may be used by attackers to bypass access controls such as the same-origin policy.

Ans:

Codeigniter | Types of error logging

There are three message types in Codeigniter:

Error Messages These are actual errors, such as PHP errors or user errors.
Debug Messages These are messages that assist in debugging. For example, if a class has been initialized, you could log this as debugging info.
Informational Messages. These are the lowest priority messages, simply giving information regarding some process.

 

Ans:

Codeigniter | routes 

Routing rules are defined in your application/config/routes.php file. 

View Detials