How do you set up cakephp on a shared hosting?

This is one thing I haven't been able to do with Cake. I have tried it a few times and couldn't figure it out. I am on hostgator and it could help if someone could point how they've been setting it up (Advanced installation).


I have read the documentation and I get errors. I guess I haven't been reading it all too well.

Edit I just found this post.


My best shot at your problem is this:

You will probably have a user directory (probably /home/user) containing a /public_html directory or /htdocs or even a /html where you are supposed to put your files in.

In my personal experience you should descompact your cake/project files on this directory (/public_html from now) like:


and you will end with your website root in this structure, located at:


Most Hosting sites allow you to put a .htaccess files on the root dir:


You will need to creat this .htaccess file with following content:

DocumentRoot /home/user/public_html/app/webroot

Just remember that the /home/user/public_html can be anything, but you can probably figure it easily, via shell or calling the host support.


This is exactly what I did on

I made a domain like usual, lets call it

in the root directory I had the cake directory which I simlinked as just 'cake' So it was /home/myusername/cake which contains the cake unzipped.

in my homedirectory I edited the file .bash_profile and added this line at the bottom of the file.

export PATH=$PATH:/home/myusername/cake/cake/console

Then you need to logout and log in again or source the .bash_profile

Now you can bake.

After you bake your app inside you have to edit the file /home/myusername/

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
//You should also use the DS define to separate your directories
define('CAKE_CORE_INCLUDE_PATH', '/home/myusername/cake');

You see in the last line, you point it to the cake source directory. This way you can actually have many cake apps all using the same cake app directory.

Kind of sweet right ?

But that is not all. Inside the /home/myusername/

You need to create a .htaccess file and put this inside it.

<IfModule mod_rewrite.c>
RewriteEngine on
rewriteRule ^(.*)$1 [L]
RewriteRule ^.* [R=permanent,L]

And now you are on your way to cake bliss.

Category:php Time:2009-02-24 Views:1
Tags: php cakephp

Related post

  • CakePHP on a Shared Hosting public_html 2011-01-25

    I have installed my cakephp on a shared host server. I always get a 404 error The mod_rewrite looks like this /home/user/public_html/cms/.htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/we

  • fixing cakephp .htaccess/mod_rewrite for shared hosting setups 2009-06-04

    I'm trying to install cakePHP on a shared hosting setup. After extracting the files to a location like ~/public_html/dev/cake and visiting the appropriate URL (in this case http://hostname/~username/dev/cake/), I receive a 404 error: Not Found The re

  • Setting up cakePHP on shared host and remove /app/ in URL 2010-01-27

    I've installed cakePHP on a shared server where I can't set the Apache webroot, so it's currently pointing to /public_html. In that folder I have /cake, /app, /vendors, etc. Everything works fine; the only problem is that rather than links to control

  • Can a fixture be changed dynamically between test methods in CakePHP? 2008-09-01

    Is it possible to have a fixture change between test methods? If so, how can I do this? My syntax for this problem : In the cakephp framework i am building tests for a behavior that is configured by adding fields to the table. This is intended to wor

  • How do the CakePHP and codeigniter frameworks compare to the ASP.NET MVC framework? 2008-09-07

    As a classic ASP developer about once a year since ASP.NET came out I decide I really gotta buckle down and learn this fancy new ASP.NET. A few days in and messing with code behinds and webforms and all this other stuff I decide the new fancy stuff i

  • CakePHP ACL Database Setup: ARO / ACO structure? 2008-09-10

    I'm struggling to implement ACL in CakePHP. After reading the documentation in the cake manual as well as several other tutorials, blog posts etc, I found Aran Johnson's excellent tutorial which has helped fill in many of the gaps. His examples seem

  • CakePHP: Action runs twice, for no good reason 2008-09-15

    I have a strange problem with my cake (cake_1.2.0.7296-rc2). My start()-action runs twice, under certain circumstances, even though only one request is made. The triggers seem to be : - loading an object like: $this->Questionnaire->read(null, $

  • CakePHP multi-model view 2008-09-21

    I am creating a website in CakePHP and I am kind of new on it. I couldn't find good resources on this matter, so there you go: I have a three table structure for registering users: Users, Addresses and Contacts. I have to build a view with info of al

  • Saving information in "sub" model in CakePHP 2008-09-21

    I've got a simple CakePHP site (1.2). I've got a page where you can edit and save a Person. So I have a Person model and controller. Each Person has none or more comments, in the comment table. So I have a Comment model, and I have a hasMany associat

  • Add dismiss control to session-flash() output in CakePHP 2008-09-24

    In a CakePHP 1.2 app, I'm using flash();?> to output messages like "Record edited". It's working great. However, I want to add a link called "Dismiss" that will fade out the message. I know how to construct the link, but I don't know how to insert

  • Best practice for placement of display logic in a view in CakePHP 2008-09-25

    I have a CakePHP 1.2 application. I'm running into the case where I need to do some logic to render things correctly in the view. Example: I have a table called Types. There are flags for various types, so each row has one or more BOOL fields set. Fo

  • Three table model relationship in CakePHP 2008-09-26

    I've got a CAkePHP 1.2 site. I've got three related Models/tables: A Comment has exactly one Touch, a Touch has exactly one Touchtype. In each model, I have a belongs to, so I have Comments belongs to Touch, Touch belongs to Touchtype. I'm trying to

  • CakePHP hasAndBelogsToMany using save() vs. saveAll() 2008-09-29

    I am using a very intrinsic database with a CakePHP application and so far my multi-models views and controllers are working fine. I have a singular table (Entity) that have it's id on several other tables as the Foreign Key entity_id Some tables are

  • How do I send arrays between views in CakePHP 2008-10-02

    I am not sure if I formulated the question right, but still ... I have a view that shows a flash embed and this flash take as parameter a /controller/action URL that generates a XML. I nee to send, from this view, an array to the XML generator action

  • How do I add an MSAccess connection to CodeIgniter or CakePHP? 2008-10-07

    I'm trying to use a Microsoft Access database for a demo project that I'm thinking of doing in either CodeIgniter or CakePHP. Ignoring the possible folly of using Microsoft Access, I haven't been able to figure out precisely how the connection string

  • CakePHP - How do i set the page title to an item name? 2008-10-10

    OK, so I'm trying to teach myself the CakePHP framework, and I'm trying to knock up a simple demo app for myself. I have the controllers, views and models all set up and working, but I want to do something slightly more than the basic online help sho

  • How can I write a complex find query in CakePHP without using `$this->Model->query()`? 2008-10-13

    Hey all I'm hoping someone has enough experience with Cake PHP to make this work. I'm working on something that at the moment could affectionately be called a twitter clone. Essentially I have a set up like this. Users have many friends. This is a ma

  • Validate field in model with no table (CakePHP) 2008-10-15

    I've got a model in CakePHP that doesn't have a table, called Upload. I've got a validation in this Model for a field called source_id. I've got a form that builds a nice looking $this-data, giving me a well formated set, including: $this->data['U

  • Phalanger with cakephp 2008-10-15

    Has anybody been able to use CakePHP in Visual Studio using Phalanger --------------Solutions------------- I've just tried. Using Phalanger 2.1 (march 2011) and CakePHP 2.0, there are just missing SplFileInfo and RuntimeException classes, that should

Copyright (C), All Rights Reserved.

processed in 0.285 (s). 13 q(s)