FuelPHP Command Line Oil with Windows BAT File And XAMPP
Posted on : 23-08-2011 | By : TheBizzTech | In : FuelPHP, Model-View-Controller (MVC), PHP, Programming
Tags: Codeigniter, FuelPHP, MVC, PHP, PHP 5, Programming
47
I have been using the Codeigniter PHP MVC framework for awhile now and have started to realize I need some extra features that are not built in by default. A few weeks ago I came across a Twitter post by Phil Sturgeon about a new PHP framework he is involved in called FuelPHP. I started looking at it and realized it had a lot of the features right out of the box that I have been looking for. It has things like Migrations, a Command Line tool, and HMVC.
I am not going to get into all of these features as FuelPHP has some decent enough docs to get you started. What I am going to explain a little bit about is their command line tool called OIL. For starters, those of you who know Ruby on Rails will be fairly familiar with the idea of using the command line. There is a command simply called rails, in Ruby on Rails, that allows you to manage much of your app. With Oil you can do things such as build scaffolding, inspired by Rails, run your own tasks, and build models and controllers.
Oil works perfectly well on *nix type machines, but I have had issues running PHP command line from Windows 7 and XAMPP. Here are two ways I have been able to run Oil using Windows command line. There is a way to be able to type just php from the command line by chaining the PATH, but for some reason I am not able to get it to work on my machine at all. After many times trying I have just gone with the next two approaches.
When you run a PHP command on *unix you generally just have to type php followed by your commands; this however did not work for me on Windows running XAMPP. The first way to solve this is instead of just typing php you have to type the full path to the php.exe file. Since I am running XAMPP I would always have to type something like this “xampp\php\php.exe” every time I wanted to run PHP.
The second option is to run a batch file. In the main directory of the FuelPHP package their is your file called oil. In this same directory create a file called oil.bat. In this file you will put the path to your PHP install and some command line helpers. This text below is what I have in my oil.bat file and it basically looks for a file called oil and takes the arguments you entered and passed them to oil.
@c:\xampp\php\php.exe %~n0 %*
Note: this may be different for you depending on where you have XAMPP installed, and where your php.exe file is located. Now to run oil you basically just run something like this from the command line.
oil.bat help
If anyone has an easy way to be able to fix my issue with running a simple php command from the command line let me know, otherwise these two options above should work just fine.


Just what the docotr ordered, thankity you!
Very nice, i suggest webmaster can set up a forum, so that we can talk and communicate.
Author where you can subscribe to the rss feed?
Hey, good to find somoene who agrees with me. GMTA.
Thank you for this kind of info I had been browsing all Msn to be able to find it!
Just cause it’s smilpe doesn’t mean it’s not super helpful.
Much appreciated for the information and share!
I’m so glad that the internet alolws free info like this!
Maintain up this superior work, you have a good blog over here with much fantastic information and facts! When you post some new stuff, I’ll visit your weblog again and I’ll follow it.
If information were soccer, this would be a goooaool!
Greetings! Extremely valuable suggestions on this informative article! It really is the small adjustments that make the greatest modifications. Many thanks a whole lot for sharing!
Well put, sir, well put. I’ll ceartinly make note of that.
Hello everyone! Cool blog! Do you know more blogs on this topic?
I would suggest to checkout Phil Sturgeon’s blog http://philsturgeon.co.uk/blog. He is one of the developers.
Hey! Many thanks for your site! Honestly I have never read anything that great.
Love your blog!
Wow! Thank you! I continually needed to write on my blog something like that. Can I implement a portion of your post to my website?
That’s fine. It took me awhile to figure this out so the more people it can help the better.
I appreciate your nice info, really help me. I will revisit your site.
All bloggers must be see this good post, applaus your to your posting.
I appreciate your nice info, really help me. I will revisit your site.
Nice info. I will be back, to read your nice info.
Hey there, You have performed a fantastic job. I’ll definitely digg it and individually recommend to my friends. I’m sure they’ll be benefited from this web site.
Would you mind if I published this article on my blog? I would certainly give you credit and a link back to your website. Thank you, and don’t hesitate to let me know here!
Sure that’s fine.
Many thanks for sharing to us, I would love this blog, and bookmark now.
I should say, some of this was a little over my head, but all in all, i enjoyed reading your post
Just like someone else documented what a this wonderful blog.
Cool design. Did you make this site yourself?
I purchased the WordPress theme. I spend more time on server side programming and do not build WordPress themes myself.
Hello, are you accepting any ads in your blog? I would love to purchase a banner for a couple of months advertising my web site that is closely related. Let me know, or give me an email that I can reach you at. Cheers!
I?m gonna ubscribe to your feed. I will appreciate if you continue this in future.
Yeah! Excellent piece, continue to keep up the terrific work.
Nice read, I just passed this onto a colleague who was doing some research on that. And he just bought me lunch since I found it for him smile So let me rephrase that: Thank you for lunch!
Keep working ,splendid job!
After all I will be subscribing to your rss feed and I hope you write again very soon!
Hey, stumbled upon this website from a discussion board I routinely visit, and had been wanting to know if I could use the site as a source in one of my own web pages. All of the credit would certainly be supplied to the primary source, i.e. : http://thebizztech.com/2011/08/23/fuelphp-command-line-oil-with-windows-bat-file-help-and-xampp/ . Would like it, so please make sure to get to me by my e-mail in the event I can’t: Mcbroom@gmail.com . Thanks a lot
Sure you can site the article.
Greetings from California! I’m bored to tears at work so I decided to browse your site on my iphone during lunch break. I really like the info you present here and can’t wait to take a look when I get home. I’m shocked at how quick your blog loaded on my cell phone .. I’m not even using WIFI, just 3G .. Anyways, excellent blog!
Thanks for your concepts.
Excellent stuff here Within the famous words of a specific terminator… il be back!
I should say, some of this was a bit over my head, but all in all, i enjoyed reading your post.
As a site owner I believe the material here is reallyfantastic. I appreciate it for your efforts. You should keep it up forever! Best of luck.
Very nice post, I certainly love this website, keep on it.
I just want to tell you that I’m beginner to weblog and certainly enjoyed your website. Most likely I’m planning to bookmark your blog . You amazingly come with amazing articles and reviews. With thanks for sharing your web-site.
I would like to thank you for the efforts you made in writing this post. I am hoping the same best work from you in the future as well.
awesome article! and no beating around the bush, i like when people are straight to the point.