Hi, there are many tutorials about this, but i would like to type the steps i followed in order to get cakephp working on my user public_html folder.
as many of you probably know, if you have apache's userdir module loaded, you can put your web pages on /home/user/public_html , and access them with the url: http://localhost/~user/ . I really prefer this, so all my web pages are on my personal home, but how to configure cakephp to work with these paths, i got a hard time with this, but finally got it!. here's how:

in case you don't have apache2's userdir module:
CODE
sudo ln -s /etc/apache2/mods-available/userdir.load /etc/apache2/mods-enabled/userdir.load
sudo ln -s /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-enabled/userdir.conf


you need the rewrite module also... (this could be done with the same method used for userdir)
CODE
sudo a2enmod rewrite


Now lets edit some apache files...
CODE
sudo vim /etc/apache2/sites-enable/000-default

inside the first two <directory></directory> tags, change the AllowOverride lines:
CODE
<Directory />
                Options FollowSymLinks
                AllowOverride All      // change here
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All         // change here
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                #RedirectMatch ^/$ /apache2-default/
        </Directory>

do the same on /etc/apache2/mods-enabled/userdir.conf
CODE
<Directory /home/*/public_html>
                AllowOverride All        // change here
                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        </Directory>


Now you need to restart you apache2 server...
CODE
sudo /etc/init.d/apache2 restart


i'll assume you've already downloaded cakephp latest release or that you know where you can find it

unpack the downloaded file in /home/user/public_html/
rename the extracted folder (thats the name of your application)
CODE
cd /home/user/public_html/application_name

edit the .htaccess file so it look like these:
CODE
<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
   RewriteBase  /~user/application_name/
</IfModule>


now point your browser to http://localhost/~user/application_name and you show see cakephp's default page
good luck!

 

 

 


Reply