Deploying my project to a shared host

My topic is similar but not the same as others posted here.

I am a hobbyist. My living doesn’t depend on CakePHP but my fun does! I have a shared hosting account and I run several static websites as folders off public_html.

My question is: Can I deploy my CakePHP project by just uploading all the files to a folder below public_html? Is it legal or is it poor programing practice.


Yes, you can. Read this also:

I think this technique will be easy for you


  1. You have access to cPanel/File Manager
  2. Your root folder is /home/username
  3. Your public (web) folder is /home/username/public_html


  1. Copy the contents of your application’s root folder (CakePHP or whatever your application folder is) to /home/username. This will result in Your application’s bin folder going to /home/username/bin and so on
  2. Remove public_html folder and create a new symlink ‘public_html’ pointing to /home/username/webroot

Yes, you can deploy your cakephp site on shared hosting by uploading the files to the folder. However, you must follow a proper process.

First, structure the directory like this:

    // webroot contents goes here

    // necessary app directories go here

Change WWW_ROOT in mycakeapp/config/paths.php on line 52:

define(‘WWW_ROOT’, ‘/home/username/public_html/’ . DS);
Change the path to bootstrap.php defined in the webroot index.php file on line 28 (located at /home/username/public_html/index.php):

require ‘/home/username/mycakeapp/config/bootstrap.php’;

You should also note that shared hosting is not recommended for big websites. It is good enough for personal blogs, but not for business or startup websites. For that you should better go with infrastructures like DigitalOcean or Linode. Both are affordable and provide better performance and security. If you don’t know how to manage the servers yourself, you can go with some managed PHP mysql hosting service. With managed services, the service provider manage the servers for you.

Can I deploy my CakePHP project by just uploading all the files to a folder below public_html?

Yes, a CakePHP app can be run off a sub folder within your webserver’s document root (public_html in your case).

Is it legal


or is it poor programing practice.

It’s not ideal but we don’t live in a ideal world :slightly_smiling_face:

getting the following error

Fatal error : Uncaught Error: Class ‘Cake\Routing\Router’ not found in /home/username/mycakeapp/vendor/cakephp/cakephp/config/bootstrap.php:26 Stack trace: #0 /home/username/mycakeapp/config/bootstrap.php(32): require() #1 /home/username/public_html/index.php(19): require(’/home/sudhir251…’) #2 {main} thrown in /home/username/mycakeapp/vendor/cakephp/cakephp/config/bootstrap.php on line *26
note : replace username with my username

Looks like your autoloading is not set up correctly.