This book assumes prior knowledge of PHP—this should also stretch to a web server. CodeIgniter needs a web server to run on, just like any other PHP application. You can install CodeIgniter locally just for testing, or use it on your current web server; anywhere will suffice.
The first step to getting started with CodeIgniter is to download the files from the website. The website is located at www.codeigniter.com. This website includes a backlog of all of the previous versions of CodeIgniter, as well as a Subversion Repository (SVN) for the latest version. In our case, we can simply download the latest version straight from the home page—currently 1.7.2— by clicking on the Download CodeIgniter button, as seen in the next screenshot.
When you have downloaded the ZIP file, unzip it using your favourite file archiving program. You will now have a folder named CodeIgniter_1.7.2
. The folder should contain two files and two directories, as seen in the next screenshot.
The system
directory holds the core CodeIgniter files, libraries, and other CI specific stuff, such as the logs and cache directories. It also houses the application
folder—this is the only folder you truly need to worry about, as this is the only place where you need to put your files. As you can guess, this is the folder where all your application-specific code goes, and includes the configuration files that you may need to edit.
Simply open this folder in your code editor of choice and we'll go ahead and install CodeIgniter in our final step. We need to edit the base URL—the URL at which you will you access your application—and to do this we need to open the file /system/application/config/config.php.
The value that we need to change is the array item $config['base_url']
which is currently set to http://example.com/
—simply change this to your URL.
When that is done, navigate to your base URL and you should see the CodeIgniter welcome screen, as seen in the next screenshot.