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.
Your public (web) folder is /home/username/public_html
Steps:
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
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:
/home/username/public_html/
// webroot contents goes here
css/
img/
js/
.htaccess
index.php
/home/username/mycakeapp/
// necessary app directories go here
/config
/logs
/plugins
/src
/tmp
/vendor
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):
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.
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
I am not happy that it is not possible to host my cakephp website on a domain. I tried to host my cakephp website on addon domain by uploading the files and it is not working. There is no way to find how to do it on the web Only way is to put my files on sub folder and redirect the domain to that folder which is not good .,
This is not a Cake-specific thing. There’s no magic that’s required because it’s Cake. And the steps required to deploy a site will vary depending on what access you have to your server, how the web server is configured there, whether you’ve customized your file structure, and more. So there’s no tutorial that will cover everything.
I can tell you that you need to make sure that everything needs to be transferred, including the vendor folder and hidden files like .htaccess, and case sensitivity is important on Linux servers but not on Windows. Those are some of the common mistakes.
If you want more help, you’ll need to provide more details about your dev and production setups, how you transferred your files, etc. “I tried to host my cakephp website on addon domain by uploading the files and it is not working.” is not useful to anyone trying to help. What files did you upload? Where did you upload them to? Why do you think that was a good place to put them? What does “not working” mean?