Setting up CakePHP with fastCGI

Posted by Jason on July 2, 2007 at 11:36 am

Cake PHP LogoI’ve been using CakePHP for quite a while now with no .htaccess issues at all, either running locally or on hosted sites. That all changed last night when I couldn’t get it to work at all on one of my budget hosting sites. Instead of my application all I saw were 500 Internal Server Errors.

I found that the issue was definitely down to one line in the root .htaccess (which was unmodified from the original CakePHP download):

  1. RewriteRule    (.*) app/webroot/$1 [L]

Unfortunately my cheaper hosting doesn’t allow me access to the error logs so it was difficult to diagnose the problem. By 11:00 last night I was certainly not in a good mood and no closer to an answer. I managed to Google plenty of references to similar issues but none solved my problem.

This morning I resorted to the hosting company themselves and within an hour they came up trumps! My thanks to Rob at VirtualNames support who not only worked it out, he even changed the file for me!

It looks like the problem is that the mod_rewrite rules don’t like fastcgi, which is the preferred option for this hosting account – it seems to try and redirect the internal URLs for fast cgi causing a rewriting loop. VirtualNames support felt it would probably work if the PHP mode is switched back to module mode, but they also came up with a fix to the .htaccess in the domain folder to (the root .htaccess for the CakePHP installation):

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine on
  3. RewriteCond   %{REQUEST_URI}  !^/cgi-bin/
  4. RewriteRule    ^$ app/webroot/    [L]
  5. RewriteCond   %{REQUEST_URI}  !^/cgi-bin/
  6. RewriteRule    (.*) app/webroot/$1 [L]
  7. </IfModule>

This stops it trying to redirect the fastcgi internal access urls, and appears to cure the problem. It looks like the other .htaccess files do not need changing. .htaccess and rewrite rules are still a bit of a black art to me. After this they are going on my list of things to pick up!

I can also recommend VirtualNames as a budget hosting solution should you need one. Their support people actually do…erm…’support’ ;)

Setting up for web development on OS X

Posted by Jason on June 16, 2007 at 4:12 pm

I’ve been slowly working through all of the bits I usually use for web development on my MacBook, attempting to get it set up in a similar way to my PC. No particular reason for that, it’s just what works for me and means I can swap between machines whenever I like – PC for the working week and Mac for out-of-hours seems to be my pattern…

On the whole it has gone fairly smoothly, though it hasn’t been entirely without problems. Here is the detail of what I have set up and where I came across issues. It might help someone if they come from a similar background to me of PC development.
(more…)

Consultancy and Development work at Minorplanet

Posted by Jason on February 26, 2007 at 8:53 am

Minorplanet Offices, LeedsSo here I am at Minorplanet, close to Leeds city centre. A short term contract working with the development team, but actually as part of their operations team. (more…)

Mura Martial Arts

Posted by Jason on December 10, 2006 at 9:53 pm

Mura Martial ArtsDeveloped for Mura Martial Arts Clubs near Selby, the requirement was for an informational site which could be easily kept up to date by the club. (more…)

Google has the right idea

Posted by Jason on September 28, 2006 at 5:22 pm

I envy this guy deeply:

http://steve-yegge.blogspot.com/2006/09/good-agile-bad-agile_27.html

I’ve spent a lot of time recently using Google and Google based technologies (Google Earth, Google Mail, Google Home Pages, Google Analytics, Google Spreadsheets, etc, etc) and I just never fail to be impressed. I didn’t even mention creating my own modules for my Google Home Page which is just a joy. Being a developer of SharePoint Web Parts from time to time I have a view of the ‘other side’ and just how hard it is to get things to work as you want. It’s always too complicated – people just want information and my job of getting that to them is far harder than it should be.

But Google stuff just works! It’s simple, and it JUST WORKS! The way they get to work results in people creating stuff that other people want. It must be the way they work, I can’t see anything else that would cause that effect.

« Previous Page