Archive

Archive for June, 2008

Production setup on shared host environment

June 3rd, 2008

Today was a grand day… after days of being confused with Cakephp and getting it setup up on my localhost (Apache2, PHP 5, MYSQL 5 on Ubuntu desktop edition), I finally managed to figure it out…

I have been following the IBM Developerworks “Cook up Web sites fast with CakePHP” series from Duane O’Brien and followed the first part with a “normal” development setup. Then i realised that if i were to upload to my web server (4UHosting shared), i would not be able to change the apache httpd.conf file. I decided to try and search for a way to have a production setup on a shared host (mainly for security reasons).

I was following a couple of guides… firstly an aptly titled article “Production style on a shared host” by Andy from http://www.ad7six.com/

I followed the guide to the letter and managed to get the index page working (http://localhost/). However when i went to http://localhost/users/register i was thrown up a “this file does not exist” error.

I then tried the suggestions in this article entitled “In the Kitchen with CakePHP” (changing the .htaccess files) – this didn’t solve my problem either.

I then decided to have a look at my httpd.conf file. Sure enough, the entry for my web docs folder (/var/www/) had AllowOverride set to None. so i changed the entry to “AllowOverride All” and saved (as sudo) then restarted the apache2 server using the command: sudo /etc/init.d/apache2 force-reload

Worked a treat! So, after this little escapade i attained that in order for cake to work with the mod_rewrite urls on a shared server – the web document folder must have AllowOverride All in the httpd.conf file for the server. Seeing as we do not have access to this file in a shared hosting environment, we have to hope that it is turned on or ask the web host to do this for us. Maybe i’m just being ignorant and all shared hosts already have AllowOverride set to all for each users web document folder (in my case a folder entitled “public_html”).

Dan Spencer cakephp, Computing