Tuesday, October 21, 2008

Solution to loading CakePHP styles in XAMPP

After much trial and error setting up CakePHP on Xampp (or WampServer 2.0) I finally found the problem.

The Issue: After setting up the Cakephp structure in my htdocs/ folder in Xampp, I loaded the project through http://localhost/. The page would load but none of the styling set out by the cake css sheet was rendering. The book Beginning CakePHP, mentions you need to alter the site (in my case Xampp's) httpd.conf file. It suggests you change to


<Directory /dir/to/cake>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>


This is fine but I wasn't sure if this reference is relative or not. After testing it with a quoted path, relative, and an absolute path. I decided it was something else.

The Solution: With more research I discovered something the book forgot to mention. This was to change another line in the httpd.conf file. There is a line for a module that needs to be uncommented (remove the # in front of it) - that line is this:


LoadModule rewrite_module modules/mod_rewrite.so

This waisted about an hour of my life and I am hoping this post will save someone else that hour. Happy programming.

No comments: