Setting up CakePHP shared hosting
I am following this doc for installing CakePHP on a shared hosting host: http://book.cakephp.org/view/915/Advanced-Installation
I can't figure out where to install the cakephp files on my server.
Right now I have:
/public_html
.../cake
....../console
....../config
....../scripts
....../tests
.../app
....../models
....../views
....../controllers
....../and so on...
.../b开发者_运维问答log( MY SITE )
....../css
....../img
....../files
....../js
......(.htacess) file
......index.php
.../libs
....../all the libs files
Is this the recommended set up? Or should I have the following directory (all came in the CakePHP install) in the root folder(dir above public_html, basically '/home/myusername/')?
/cake
/app
/libs
It does't really matter how exactly you do it, as long as it works. But, you should keep the "internal" files out of the public web root. Say your host gives you access to this kind of directory structure:
/camman
/public_html
The public_html
folder is set as the web root, anything in there is exposed to the web. You can dump all your cake files in there and let rewriting take care of it, but it's better to only expose Cake's /app/webroot
there, which is the only folder containing public files (CSS and so forth). The rest of the files should be kept above the web root like so:
/camman
/myapp
/app
/cake
/public_html
.htaccess
/css
/img
index.php
...
Only the contents of the /app/webroot
folder go into the public_html
directory, the rest is placed somewhere private. That means you need to update the paths defined in /app/webroot/index.php
. This setup is better since files in /app
contain critical information like passwords, which you do not want publicly exposed in case of a server failure.
精彩评论