Free Android CakePHP GMaps Articles by Bali Web Design

November 8, 2010

How to install cakephp on hostgator shared hosting

Filed under: cakephp,php — admin @ 8:03 pm

I just buy new shared hosting account for my new domain on hostgator. I want to install cakephp web application into this hosting. However the local setting or common setting that i used on other hosting is not work on hostgator. After figure out the problem, i found that the hostgator hosting does not allow for changing DOCUMENT ROOT setting.

So after research on cakephp tutorial, which come to setting cakephp on shared hosting and i think this solution also good for production phase. I will mention how i set my cakephp on hostgator

  1. move app, cake, plugins, vendors folder into your hosting root folder. It is user root folder on your hosting
  2. delete .htaccess and index.php on cakephp root folder
  3. move /app/webroot/*.* to /public_html folder
  4. delete empty /app/webroot folder
  5. edit /public_html/index.php to point to the ‘cake’ and ‘app’ directories. For example my public_html path for my domain is /home/myhost/public_html, so i point
    – ROOT to look at /home/myhost
    – APP_DIR to look at /home/myhost/app
    – CAKE_CORE_INCLUDE_PATH to look at /home/myhost/cake
  6. edit this line on /public_html/index.php with your appropriate path
    if (!defined('ROOT')) {
    define('ROOT', DS.'home'.DS.'myhost');

    if (!defined('APP_DIR')) {
    define('APP_DIR', 'app');

    if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    define('CAKE_CORE_INCLUDE_PATH', DS.'home'.DS.'myhost');

  7. The only .htaccess i have on /home/myhost/public_html, the setting for .htaccess look like this
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]


  1. Your steps worked great for me on hostgator. The only thing I had to change (maybe I have a newer version of cakePHP) I didn’t need to do this step

    if (!defined(‘CAKE_CORE_INCLUDE_PATH’)) {
    define(‘CAKE_CORE_INCLUDE_PATH’, DS.’home’.DS.’myhost’);

    I think new builds of cakePHP don’t have a /cake directory

    Comment by laser quest — February 3, 2012 @ 12:22 pm

  2. Many many thanks….. after spending hours and hours and hours of reading manuals/tutorials and trying out things, you solution just worked!!!! thanks a lot! This is cake 2.2.2 on hostgator!!!

    Comment by sal — October 17, 2012 @ 6:46 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment