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 fuelphp.com.

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 get.fuelphp.com/oil | 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 fuelphp.com 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>
        <Directory /home/{user}/Public/{app name}/public>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

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).

Conclusion

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.

Advertisements

Creating Files Using the Command Line


Trying to do a simple post a day can be quite difficult, I have found. Thinking up new and original content is nigh impossible everyday, and while I have a dozen or so major articles and tutorials in the works, today is going to be something simple.

To this end today I have decided to talk about creating files in the command line.

There are many options, although three come to mind, each with there specific purposes.
(more…)

Quick Tip – Fixing a Failed Apt-Get Update – Ubuntu


Woke up this morning, and as usually I had new software to download and install through updater on Ubuntu 10.04. So I click install updates and about halfway through updating it stops. No apparent reason, but the windows is frozen and cannot be closed.

After a quick search on the Ubuntu forums and a look at man apt-get, there appears to be a fix. (more…)

Adding New Software – Ubuntu and Fedora


The greatest advantage the Linux, in particular the larger distributions such as Fedora and Ubuntu, is the vast amount of easily available software the can extend a basic setup and make it suitable for any possible situation. This is then made insanely easy by package management.

Think of package management as the ability of the user to look at all the possible software that they need and select, install, setup and troubleshoot and then provide a way to automate the procedure. It’s like the master key that unlocks the heart of functionality of Linux. The two big package management programs are yum on Fedora (and CentOS)  and apt on Ubuntu (and anything that is Debian based). They both work basically the same way and provide similar functionality. (more…)

%d bloggers like this: