getting started with CodeIgniter on Ubuntu Lucid Lynx (10.04)

As I am currently playing around with CodeIgniter (an open source PHP web application framework), I thought I could write down the few software installation steps one needs to go through in order to get started on a fresh Ubuntu box. And all you really need is a LAMP (Linux Apache MySQL PHP) setup that can be up and running in less than 10 minutes (assuming the OS is already installed of course).

Install Apache

sudo apt-get install apache2

Install MySQL

sudo apt-get install mysql-server

Install PHP (with MySQL support)

sudo apt-get install php5 php5-mysql

Enable the rewrite mod in Apache

This is only needed if you plan to get rid off “index.php” in your CodeIgniter application’s URLs.

sudo a2enmod rewrite
sudo gedit /etc/apache2/sites-available/default 
<!-- Edit the configuration and change AllowOverride None to AllowOverride All -->
<Directory /var/www/>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order allow,deny
   allow from all
</Directory>

Add your site to your local web server

You could probably just extract the CodeIgniter archive into /var/www/ but you also could have your application in your home folder (/home/lroguet/www.mysite.com/ for instance). In that case, all you need to do is create a symbolic link in the Apache web directory pointing to your application folder.

cd /var/www
sudo ln -s /home/lroguet/www.mysite.com/ www.mysite.com 

Restart Apache

sudo /etc/init.d/apache2 restart

Here you go, just point your web browser to http://localhost/www.mysite.com/ and you should see the CodeIgniter example pages.

7 thoughts on “getting started with CodeIgniter on Ubuntu Lucid Lynx (10.04)

    1. Ludovic ROGUET Post author

      Sure and I’ll use that next time. I just think it is nice, the first time at least, to do it step by step and understand what is installed and why you need it ;)

      Reply
  1. Mick

    Just a quick note on using

    sudo tasksel install lamp-server

    If this does not work you then have to figure out why and wonder what state your system has been left in – for example on an install I did my hosting provider had already installed apache (which I did not realise). During the apache install this causes a question to the user to ask if they want to keep the existing config file or overwrite it. It appears that tasksel is not equipped to handle this user interaction and so it just hangs, and must be killed.

    There seem to be similar issues other have seen (google ‘tasksel hangs’).

    Personally I will use the step by step approach from now on to avoid this type of issue.

    Reply
  2. Bilal

    Hi,
    i have got a very specific problem.I am using wamp server to run my codeigniter projects locally.I have loaded mod_rewrite in and it is showing in my phpinfo.

    In my wamp root directory, i have a codeigniter project folder “mysite”.Here is the directory structure of mysite.

    -mysite
    |–images
    |–eshots
    |–useruploads
    |–temp
    |–SpryAssets
    |–css
    |–js
    |–timthumb

    After enabling this mod_rewrite,i modified my “host” file in my windows directory and added this line of code in my virtual host file to access my website like this. (mysite.local)

    127.0.0.1 mysite.local

    After this i created an htaccess file in root direcotry (i.e under mysite folder)

    htaccess file:

    RewriteEngine on

    RewriteCond $1 !^(index\.php|images|lists|eshots|useruploads|temp|SpryAssets|css|js|robots\.txt|timthumb\.php)

    RewriteRule ^(.*)$ /index.php?$1 [L]

    SecFilterEngine Off

    SecFilterScanPOST Off

    After this,when i try to access my website from the wamp,it leads me to nowhere.For example, if i click from localhost’s project folder i.e mysite, it takes me back to the localhost folder and my url looks like this:

    http://mysite.local/mysite/

    and when i click on mysite again ,it shows the url like this:

    http://mysite.local/mysite/mysite

    And after this,my link doesnt take me to the web pages.And remain stuck here.
    IS THERE ANYONE WHO COULD CORRECT ME WHY I AM GETTING THIS BEHAVIOR FROM SERVER??IS THERE ANY PROBLEM WITH CODEIGNITER or htaccess file that is stopping this??? AND WHAT STEPS I NEED TO DO SO THAT I COULD GET EACH N EVERYTHING WORKING including javascript, css, images .

    **KINDLY ADVISE ME TO DEAL WITH THIS CHALLENGING PROBLEM!! NONE COULD HELP ME**.
    Mostly people say you need to have your mod_rewrite enabled or read manual provided from Apache .I have done everything But still I AM STUCK FOR MORE than 2 weeks to proceed any further.Help me plz!!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>