Start using Fuel PHP today

The last few days I have been busy looking at the Fuel PHP framework. And it’s AWESOME. That’s not a great description, its not even very objective, but none the less it is true (you will have to take my word for it now). The framework can be found at

Today I am going to give a quick guide for installing and running Fuel PHP on a linux machine and some extra cool tricks to make the setup easier. First what things do you need, assuming that you have a fresh linux install.

  • apache webserver
  • php 5.3 (needs to be at least 5.3)
  • php cli (command line interface)
  • mysql database server
  • command line editor vi or vim (not totally necessary but i will assume that you have one as I believe command line file editing to be the easiest option)
  • wget or curl (fuel documentation uses curl but either could be used)

I will also assume that you have root access and that you are on a home computer using localhost for your domain. Production environments require more careful setup and I will address those issues in a completely different post.

Lets Go

1. install all the necessary components

sudo apt-get update
sudo apt-get install php5 php5-cli apache2 mysql-server phpmyadmin curl vim git-core

2. install the fuel PHP oil installer. (that sounds strange)

curl | sh

3. change into the directory that you want to build you fuel application in and run the fuel PHP oil create script. replace {user} with your username and {app name} with the name you want to give your application. it doesn’t matter what the name is as it wont get used in the website URI

cd /home/{user}/Public/
oil create {app name}

4. Now it that’s as far as the basic section of the documentation on the documentation website. However you cannot access the app in the browser yet. Before you can do that there are a few steps that you must take. We have to set up the apache virtual host. This greatly varies on you operating system, but for simplicity I will cover just Ubuntu, and will cover different OS’s later. We need to alter the virtual host so that it follows symbolic links and knows what the root directory of the website is. Because the fuel index.php file is in the public folder in the actual top directory we will include the public directory in the website root directory.

sudo vim /etc/apache2/sites-enabled/000-default

Now make the file look like this:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /home/{user}/Public/{app name}/public
        <Directory />
                Options FollowSymLinks
                AllowOverride All
                Order allow,deny
                allow from all
        <Directory /home/{user}/Public/{app name}/public>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

Restart apache to apply the configuration changes

sudo /etc/init.d/apache2 restart

5. If everything worked you should now be able to go to http://localhost/ and the fuel app page should be visible. It looks a little bit like the codeigniter welcome page. (most of the developers of fuel have or still do contribute to codeigniter).


Hopefully this is guide is a relatively straight forward explanation of how to set up fuel on a new development environment. Any questions or comments are appreciated. I’m sure I made a mistake somewhere in there or perhaps it just didn’t work on your computer. I would also love to get some suggestions on what you would like to see next.

%d bloggers like this: