Deploy on Hostgator

Hi

I’ve got a fully developed web app but i can’t figure out how to deploy it!

I’ve been messing about with .htaccess files and various directory structures all day but i can’t make it work.

Can’t quite believe it to be honest. Didn’t expect it to be such a vast hurdle!

I thought maybe i could just put the webroot folder and the root index and htaccess files in the public_html folder. Then put the rest of the application in an “app” folder in the “/home/username”. And then use htaccess rules to direct everything.

Would really appreciate some advice here as i am lost and the docs aren’t too clear on this.

Cheers.

Although there is a docs page with deployment recommendations, for your app to simply run on your remote server you don’t have to do anything other than to put the correct db connection data inside your app.php.

So yeah, you definitely shouldn’t have to do anything with the .htaccess files or anything else, really.

Simply determine which directory is public (don’t know what it is for hostgator) and put all CakePHP files inside of it (app, lib, etc.). If your db is connected properly, your site should work immediately.

One possible pitfall: Make sure that you don’t have any cache files in your tmp folders when you upload them to the server, as it can cause errors otherwise.

CakePHP installation includes .htaccess
All you have to do is upload the whole folder

raul ~/webs/bookmarker-tutorial [master !] $ ls -a
./   bin/     .git/  plugins/  tests/  vendor/   composer.json  .editorconfig   .gitignore  index.php    phpunit.xml.dist
../  config/  logs/  src/      tmp/    webroot/  composer.lock  .gitattributes  .htaccess   LICENSE.txt  README.md

You have to upload all that in your home/public_html folder (or in a subfolder). and nothing else! (if you put inside the html_folder, everything else should be in the webroot subfolder)

If you want to do the “app” folder inside home, you have to edit these files

  • webroot/index.php
  • config/paths.php

Hi

Thanks for the responses.

I started out by doing what you describe but i got errors.

The homepage of my site works fine on my local Apache server but when i upload the site to the public_html folder it gives the following error:

Error: The view for HomeController::index() was not found.

Confirm you have created the file: “common/index.ctp” in one of the following paths:

/home/username/public_html/src/Template/common/index.ctp

So i tried a few other tutorials for deploying cake projects but they were for older versions.

Any idea what i might be doing wrong? I’ve never deployed a cakephp project before so it could be something basic i’ve overlooked.

Would really appreciate a nudge in the right direction chaps.

Cheers

Just removed the following line from one of the pages:

<?php $this->extend('/common/index'); ?>

Now the page loads! Could this be files permissions?

Hi Again

So now I know the answer to this one. And it’s really daft.

Hostgator server is Linux; my server is windows; windows server isn’t case sensitive; Linux server is.

So aside from a fair bit of editing this one isn’t too bad.

Now there’s another problem so I’ll create another post.

Thanks for your replies folks.

Hello, how are you?

I performed the deploy containing the following structure (default of the creation of the project by Composer + Cakephp)

public_html /
public_html / contest
public_html / contest / bin
public_html / contest / config
public_html / contest / plugin
public_html / contest / src
public_html / contest / tests
public_html / contest / webroot
public_html / contest / .htaccess
public_html / contest / index.php

but I’m not having success. Someone who can help?
Server: Hostgator
Cake Version: 3.5