CakePHP in USERDIR
Posted by Quinn at September 27th, 2006 10:23am under OpenSource 1 Comment Permalink
I have been setting up my laptop with Gentoo Linux. So far, it's working almost like a Mac OS X. I even get to listen audio CDs, stream radio, chat with AIM/MSN/Y! or Skype, while running server applications like MySQL, PostgreSQL, PHP and Apache.
Well, I want to do lots of experimental stuff on this system, so I tried CakePHP this time. CakePHP is a well known framework that just works for rapid web development made with PHP scripts. Developing application under CakePHP is just like Ruby on Rails or sort of. It uses MVC (Model, View, Controller) architecture.
Anyway, I encountered a very little problem while trying it setup. Even though I think the installation manual is written very nicely, it was missing something for me. This post is going to be about a small tip on CakePHP but hoping to help someone somewhere.
The installation goes as configuring Document Root in Apache as an option. Or I could still go without editing httpd.conf file if installation is under Document Root. All I have to do is activate Rewrite Engine for the directory.
Installing just under Document Root like this:
/var/www/localhost/htdocs/cake_install/
become accessible as:
http://127.0.0.1/cake_install/
This works fine just as the installation document says. However, it didn't work installing it under USERDIR like this:
/home/user_dir/public_html/cake_install/
This was not accessible at:
http://127.0.0.1/~user_dir/cake_install/
Then, I noticed there is no RewriteBase in .htaccess file. So, I add this line:
RewriteBase /~user_dir/cake_install/
just after the line of RewriteEngine On to two .htaccess files which are:
- /cake_install/.htaccess
- /cake_install/app/webroot/.htaccess
Then, yes! It's working now. I went through The Cake Blog Tutorial very smoothly. It is like coding with only a few lines can built a simple web application. I am not sure what kind of usage I can come up with this framework at this moment, but I am sure I am going to have more fun playing with this cool tool.
Nate Hollingsworth said (February 28th, 2007 1:06pm)











