-
Kohana 3.x in 10 Minutes
Posted on June 11th, 2011 No commentsPrerequisites:
This guide assumes you have already completed:
So you have a LAMP/MAMP/XAMPP stack? Great!
Now we’re ready to create our first Kohana project.
- Download the source from www.KohanaFramework.org
- Extract the zip file and move the directory it to your web directory
- On Mac OS X: ~/Sites/* (subsequent references will use Mac notation)
- On Windows (wamp): C:/wamp/www/*
- On Linux (varies): /var/www/*
- Rename the directory to kohanasite.dev
- Remember the full path to this now
- something like /Users/yourname/Sites/kohanasite.dev
- Create an htdocs directory inside this directory
- Your hdtocs will be at the same level as Kohana folders application, modules and system.
- Remember the full path to this now
- something like /Users/yourname/Sites/kohanasite.dev/htdocs
- Drag index.php into the htdocs directory
- Edit 3 lines of index.php
- where it says $application = ‘application’; change it to $application = ‘../application’;
- where it says $modules = ‘modules’; change it to $modules = ‘../modules’;
- where it says $system = ‘system’; change it to $system = ‘../system’;
- save and close
- chmod or chown application/cache and application/logs to be writable by Apache
- open terminal, and cd to your application directory
cd /Users/your-name/Sites/kohanasite.dev/htdocs - chmod the two directories
chmod 0777 cache && chmod 0777 cache - or chown it to apache, wheel, www-data or whoever owns httpd process (ps aux | grep httpd)
- open terminal, and cd to your application directory
- Create a VirtualHost entry in your Apache config.
- Depending on your install, this might be in httpd.conf or…
- on my Mac it’s at /private/etc/apache2/extra/httpd-vhosts.conf
- E.g.
sudo vi /private/etc/apache2/extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName kohanasite.dev
DocumentRoot "/Users/your-username-here/Sites/kohanasite.dev/htdocs"
</VirtualHost>
- save and quit (type :wq and hit enter)
- Edit your hosts file to point to this site locally
- E.g.
sudo vi /etc/hosts
127.0.0.1 kohanasite.dev
- save and quit (:wq)
- E.g.
- Restart Apache
sudo apachectl restart
- Move example.htaccess to htdocs and rename it to .htaccess
- Note, because it’s a “dot file” it will disappear on a Mac, so use terminal:
mv ../example.htaccess .htaccess
- Note, because it’s a “dot file” it will disappear on a Mac, so use terminal:
- Now test your site at http://kohanasite.dev
- It should say Hello World!
Congratulations! You now have Kohana 3.1 running locally.
Finishing up…
Let’s enable some of the modules that come with Kohana 3.x
- Open up application/bootstrap.php
- Scroll down to the modules section
- Enable the following modules by removing the double slash in front of the module name:
- auth
- cache
- codebench
- database
- orm
- userguide
- Save the bootstrap file and refresh your browser to make sure you still get hello world
Next up… How to build a simple CMS using Kohana.
-
New Kohana 3 Resources
Posted on November 29th, 2010 No commentsKohana 3 is getting new fixes and upgrades every day. Here’s the latest batch of helpful new Kohana 3 resources on various topics.
From Mixu.net…
Kohana 3 Form Validation – validating form input (here’s another post on user input in Kohana 3)
Kohana 3 i18n – localization/internationalization
From Kerkness.ca…
Kohana 3 ORM – Object Relational Mapping
From DealTaker.com – now a 9 part Kohana 3 tutorial series
Kohana 3 Routing – Choosing the right action based on the request
From o1iver.net…
Kohana 3 Introduction – 3 part series
From elsewhere…
Migrating to Kohana 3 from Dupal in 2 weeks
Awesome explanation with diagram of (H)MVC
Seems more are coming out every day. Kohana 3 rocks.
-
Kohana 3 PHP Development Resources
Posted on December 31st, 2009 No commentsHere is the most current Kohana 3 Documentation.
Here is the Kohana 3 API.
Here is the Kohana 3 Unofficial Wiki.
Here is a link to all posts tagged with KO3 in the KohanaPHP Forums.
Here is a search result for KO3 Models. Models represent the ‘M’ in the MVC software design pattern. Chances are your Models will use a Database backend. Here’s the KO3 Database tutorial.
Here’s a great tutorial on using Views with Kohana 3. Views represent the ‘V’ in the MVC software design pattern. Update: Now there’s 8 Great Kohana 3 Tutorials at DealTaker.
Here is a search result for KO3 Controllers. Controllers represent the ‘C’ in the MVC software design pattern. In order to decide what Controller (and Action) to run, you need to use KO3 Routing.
Once you get the hang of things, you’ll find this KO3 Cheat Sheet comes in very handy, as does this Git Cheat Sheet!



