Introduction to the CodeIgniter PHP Framework - Start using CodeIgniter (
Page 2 of 4 )
Obviously, the first step that you should take before using Code Igniter is installing its source files into your test web server. To do so, simply point your browser to the following url: http://codeigniter.com/downloads/. Download the ZIP file that contains these files.
Once you've accomplished this, unzip the package and upload its folders and files to a chosen directory of your web server. In my personal case, I saved it to a “/codeigniter/” directory under the server’s root, but you may want to select a different location.
Finally, navigate to the application/config/config.php file, then open it with your code editor and configure the following array settings, as shown below:
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
$config['base_url'] = "http://127.0.0.1/codeigniter/";
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
$config['index_page'] = "index.php";
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
$config['language'] = "english";
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
$config['charset'] = "UTF-8";
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
$config['cache_path'] = 'http://127.0.0.1/codeigniter/cache/';
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
$config['global_xss_filtering'] = FALSE;
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
$config['compress_output'] = TRUE;
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
$config['rewrite_short_tags'] = FALSE;
As you can see, the above settings provide Code Igniter with crucial information about your web applications, including the base url of your site, the default language and character set, and the index file that will be utilized. Also, it’s possible to specify whether any output generated by an application should be filtered to prevent XSS attacks, and whether it should be cached and compressed previously.
Finally, there’s a number of simple options that tell Code Igniter how to handle session data. They are actually fairly easy to configure. Although, you should pay special attention to the following entries:
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
If a value of “TRUE” is assigned to the first array element, then Code Igniter will store all of your session data in a MySQL database table, whose name will be specified in the second entry. In this case, a FALSE value has been assigned to the first setting, meaning that session data will be saved to a temporary directory in the web server.
Lastly, it’s possible to configure whether the use of short PHP tags will be enabled within view files. This is something that will be discussed in more detail when I develop some sample applications for you. For now, I’ll keep this option disabled.
So far, so good. I showed how to configure the main entries of Code Igniter’s config.php file. Of course, when you edit the file in question, you’ll see that it contains a few additional settings. However, to keep things rather simple, I’m going to use only the ones discussed above.
Now that the “config.php” file has been properly setup, it’s time to move on and learn how to configure an additional file, which is located at /config/database.php and is used by Code Igniter when working with MySQL databases.
To see how this database file will be edited, please click on the link below and read the following section.
| | Discuss Introduction to the CodeIgniter PHP Framework | | | | | | | Code Igniter is a powerful, easy-to-setup PHP framework that lets developers build... | | | | | | CodeIgniter is a very easy framework to get into and it's great to see this... | | | | | | Thank you for the suggestions about Kohana framework. I think they’ll be useful for... | | | | | | I have been coding PHP and just learn CI Framework, i think it's useful especially... | | | | | | Thanks for commenting on my CI article. If you’re learning how to implement the MVC... | | | | | | Zend is not a framework...'ZEND Framework', however, is a framework. 'ZEND' can be... | | | | | | Thanks for commenting on my CI article. Actually, Zend is a framework and not ZEND.... | | | | | | thank you for the tutorial system. I am shocked at how ungrateful some people are.... | | | | | | Thanks for the words on my CI article. I really appreciate your recognition on my... | | | | | | Am simply reiterating the message extended by Zend Technologies and those developing... | | | | | | Helpful contribution, indeed. While being appreciated, it's rather irrelevant with... | | | | | | I've been 'playing around' with PHP fopr a while now, and CI is my first dip in the... | | | | | | Thanks Martin for the words on my series on using CI's main features. Glad to know... | | | | | | Hi Thankyou very much for this tutorials.
I have got
404 Page Not Found
The... | | | | | | Thanks for the comments. Concerning your error, make sure not to remove the... | | | | | | what am i doing wrong?
something's wrong.please help.
Deprecated: Assigning the... | | | | | | The errors you’re getting have nothing to do with using CI. It’s because of the... | | | | | | Hi,
I can see anything on my hello world page, it's blank.
Do i need to start... | | | | | | Hi,
It’s hard to know exactly why you’re getting a blank page, because there... | | | | | | >>> Post your comment now! | | | | | |
|
 |