-
Cool 404 Pages
Posted on June 23rd, 2011 No comments -
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.
-
Apache, PHP and MySQL in 10 Minutes
Posted on June 11th, 2011 No commentsWhether you want to start developing web applications for the first time, you’re wanting to make better use of your local computer or a virtual machine to streamline development, create a development or staging server, or just checking back as a reference for a new platform, welcome to…
Apache, PHP and MySQL in 10 Minutes
In this guide you will find the resources needed to build a web development environment on the platform of your choice
- Choose Your Platform – Mac, Windows or Linux.
- Mac OS X Instructions
- Easy - Using MAMP
- Intermediate - Using built-in Apple Apache
- Windows Instructions
- Install WampServer
- Install XAMPP
- Linux Instructions
- CPanel
- CPanel comes with Apache & PHP already installed, so here’s how to customize your install
- Note – make sure your config comes with WHM (Web Host Manager)
- Many ISPs call this a Reseller account
- How to use the EasyApache script
- Plesk
- Plesk comes with Apache & PHP already installed, so here’s how to customize your configuration
- Parallels Plesk Apache Configuration Guide
- Mac OS X Instructions
- Install any PHP Extensions you might need
- The one PHP extension that Kohana requires you that doesn’t come by default (See Kohana 3.1 in 5 minutes) is mcrypt:
- How to create a VirtualHost
- Find your Apache Config file
- Find your Apache VirtualHost config file
- Sample VirtualHost container
<VirtualHost *:80>
ServerName website.dev
DocumentRoot "/Users/username/Sites/website.com"
</VirtualHost>- More from the Apache VirtualHost documentation
- How to edit your hosts file
- Start Apache
- Start Apache
- Mac OS X:
- Terminal
sudo apachectl start
- or start Web Sharing in System Preferences
- Terminal
- Windows
- WampServer – start all services using the taskbar tray icon
- Linux
- Debian/Ubuntu
sudo /etc/init.d/apache2 [start | stop | restart ]
- Fedora
service httpd [start | stop | restart]
- ArchLinux
/etc/rc.d/httpd restart
- OpenSUSE
apachectl [start | stop | restart]
- Debian/Ubuntu
- Mac OS X:
- Start Apache
- Test your install
- Go to http://localhost in your browser
- Are you seeing the Apache start page?
- If so, you are done. Congratulations! You just installed a web server.
- Install MySQL
- Mac OS X
- Windows
- Linux
Now that you have a development environment, why not install a fantastic web development framework, such as Kohana.
Ready for round two? Kohana 3.1 in 10 Minutes
- Choose Your Platform – Mac, Windows or Linux.
-
Git Resources for Subversion Users
Posted on June 11th, 2011 No commentsI’ve been using Subversion for years, but lately I’ve been thinking it’s time to get into Git more. Plus, A lot of new GUI tools are out there and some of the older ones are still there, too, so maybe Git has matured enough for production use.
Why would I want to use Git?
Flavio sums it up quite nicely:What’re the advantages?
Since Git is a distributed revision control system (while svn is a centralized one) you can perform commits, branches, merges… on your local working directory without being connected to internet. Next time you’ll be online, you will be able to “push” your changes back to the central svn server.In a tech video from Facebook, one of the things they mention is that their developers us Git on local workstations for managing changes, and Facebook overall uses Subversion for managing the source tree centrally. I thought it was interesting that Facebook, one of the most advanced, largest and high-powered software applications on the planet, uses both Git and Subversion. Here’s an article about Using Git and Subversion Together.
I’ll be posting links to the resources I find here.
Three Part Intro to Git Series
1-2 hours • First, take the Git Crash Course.
2-4 hours • Next, read Git for Subversion Users, Part I and Git for Subversion Users, Part 2. These two articles at IBM.com give you a really good overview of the main differences between Subversion and Git.
4-6 hours • Finally, you should read Pro Git. This is an awesome free online book about Git.
After you complete these you should be a total Git.
-
How to install Memcached Memcache PHP on OS X
Posted on May 9th, 2011 No commentsThis Guide is the best resource I’ve found yet. I had to also look up how to fix pear installation errors.
-
How to Install PHP 5.3 on CentOS 5.5
Posted on April 22nd, 2011 No commentsAwesome – I found two different RPMs, try your luck with both:
How to Upgrade or Install PHP 5.3 on CentOS 5.5 at Mokonamodoki (IUS RPMs)
or
PHP 5.3 on CentOS 5.5 at Webtatic (Webtatic RPMs)
The install command I ended up using (IUS) was:
yum install php53u.x86_64 php53u-bcmath.x86_64 php53u-cli.x86_64 \ php53u-common.x86_64 php53u-dba.x86_64 php53u-devel.x86_64 \ php53u-gd.x86_64 php53u-imap.x86_64 php53u-intl.x86_64 \ php53u-mbstring.x86_64 php53u-mcrypt.x86_64 php53u-mysql.x86_64 \ php53u-pdo.x86_64 php53u-pear.noarch php53u-pecl-apc.x86_64 \ php53u-pecl-memcache.x86_64 php53u-pecl-xdebug.x86_64 \ php53u-process.x86_64 php53u-pspell.x86_64 php53u-snmp.x86_64 \ php53u-soap.x86_64 php53u-suhosin.x86_64 php53u-xml.x86_64 \ php53u-xmlrpc.x86_64
MySQL 5.1 and MySQL 5.5 on CentOS 5.5 at Webtatic (Webtatic RPMs)
If you need to do any maintenance on the existing software, packages and repos you might find these links helpful also:
-
How to install an SSL certificate on CentOS for Apache
Posted on March 19th, 2011 4 commentsGetting Apache to serve up pages over a secure connection requires a little bit of configuration.
If you want to use a self-signed certificate, you may want to look here.
Step 1. Make sure you have openssl and mod_ssl installed on your CentOS server.
yum install openssl mod_ssl
Step 2. Make sure Apache is configured to load the mod_ssl module. In my case, in /etc/httpd/conf/httpd.conf it says:
Include conf.d/*.conf
This little line of code is how the file /etc/httpd/conf.d/ssl.conf gets loaded. The SSL configuration file for Apache is where I ended up putting the configurations for my server.
Step 3. Now we’re ready to generate a CSR – Certificate Signing Request. This is something unique to your specific server that you use to generate a CRT (actual SSL certificate file) from your SSL vendor of choice. Note that this process could require several hours or days, along with email confirmations from your domain’s technical or administrative contact.
This page on the CentOS wiki gives you a great overview of the process. But after I tried that, GoDaddy complained that it needed a 2048-bit CSR. So this page showed me how to generate the CSR with a 2048-bit key:
openssl req -nodes -newkey rsa:2048 -keyout your-domain-name.key -out your-domain-name.csr
Now of course you will be replacing your-domain-name with the exact domain name (or subdomain if applicable). By default, using openssl on the command line generates files in the current working directory, but you can pass in the full pathnames if you want, too.
cat /path/to/your-domain-name.csr
Step 4. Copy and paste that mess into your SSL vendor’s ‘Paste CSR’ step of SSL Cert activation. This process varies wildly by SSL vendor, and also the level of security of SSL you purchased. Be warned that SSL Certificate authorization emails may be sent to the administrative and technical contacts on file with the domain registrar, too, so this process can take up to a few days.
Step 5. Once your SSL certificate is generated, you can download it from your SSL vendor and upload it to your server. If you’re using GoDaddy you’ll need the gd_bundle.crt file too.
Step 6. Now that you have your key, SSL Cert (.crt file) and the ca bundle (Certificate Authority) you have to edit the http.conf or ssl.conf file for Apache to know where to load the certificate files. This is how my ssl.conf looks
SSLCertificateFile /etc/pki/tls/certs/your-domain-name.crt SSLCertificateKeyFile /etc/pki/tls/private/your-domain-name.key
SSLCACertificateFile /etc/pki/tls/certs/gd_bundle.crtStep 7. Use apachectl to do a syntax check on the config files
apachectl -t syntax OK
Step 8. Fix any typos you made, and finally start or restart Apache:
apachectl restart
At this point you might get excited and try accessing your website at https:// for the first time, but on many configurations, the odds are port 443 is blocked by default. If you get a long connection or timeouts, that’s probably your issue too. So it may be necessary to open port 443 with iptables like this post shows. I found the second one worked
iptables -I INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 443 -j ACCEPT
Hopefully this helped you. -
Recursively Delete Dreamweaver _notes Terminal Mac OS X
Posted on January 21st, 2011 2 commentsCheck this out. Launch terminal and CD to your Sites directory.
cd ~/Sites
find website.com/* -name _notes -print0 | xargs -0 rmdirGotta love LinuxForums.org.
-
MySQL won’t start on Snow Leopard
Posted on December 31st, 2010 5 commentsI recently spent a lot of time scratching my head over this. Partial solution only at this point, any additional ideas would be most welcome.
I restored a Time Machine backup from an older 32-bit MacBook Pro onto a new 64-bit MacBook Pro. Apache & PHP worked fine, but I had compiled the 32-bit version of 5.1 on the 32-bit box. I had problems with MySQL starting after the restore, which led me to rm -rf everything related to MySQL including the /Library/StartupItems/LaunchDaemon, reboot, and install the 5.1.54 from the 64-bit dmg download installer.
After this, I figured I’d be fine, The MySQL preference pane in System Prefs shows “stopped”. Clicking start has no effect.
ps aux | grep mysql
shows only my grep command.
I had to do a few things to get MySQL partially working.
1) I had to
chown -R mysql:wheel mysql-install-dir/bin chown -R mysql:wheel mysql-install-dir/data
2) I discovered I can only start MySQL if, from terminal, I do:
sudo /usr/local/mysql/bin/mysqld_safe --user=root
I can’t connect to mysql from the command line with the dreaded
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I do another
ps aux | grep mysql
and see it’s starting with
/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=root --log-error=/usr/local/mysql/data/MacbookPro.local.err --pid-file=/usr/local/mysql/data/MacbookPro.local.pid --socket=/var/mysql/mysql.sock
So I make a symlink
ln -s /var/mysql/mysql.sock /tmp/mysql.sock
and try again
mysql -u root -p
Yes! Now I can use MySQL from the command line. After Googling for hours, I’ve seen others with similar install/starting problems on the latest Snow Leopard. I think it all has to do with file permissions on the /bin and /data directories.
-
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.





