====== Ubuntu and CakePHP: the right way ;) ======
My setup looks like this:
my apps are living in /home/kabturek/workspace/cake_apps/APP_ALIAS
i have cake core libs in
/home/kabturek/usr/lib/cake/1.2.x.x
and
/home/kabturek/usr/lib/cake/1.1.x.x
this allows me quickly update the core files (svn up)
i access an app by using an url http://APP_ALIAS/
This are the necessary steps:
1. install all the stuff (php, mysql ,apache, svn etc)
2. make a new file and name it like you app (APP_ALIAS)
sudo vim /etc/apache2/sites-available
and paste the folowing code in it (change APP_ALIAS (x3) to the name of the app)
NameVirtualHost 127.0.0.1
ServerAdmin webmaster@localhost
ServerName APP_ALIAS
DocumentRoot /home/kabturek/workspace/cake_apps/APP_ALIAS/webroot
Options FollowSymLinks
AllowOverride All
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
ServerSignature On
3.run these commands
sudo a2ensite APP_ALIAS
sudo invoke-rc.d apache2 reload
the first one enables your virtual host and the second one reloads apache to let it know it has a new vhost :)
4. for the url to work you must edit /etc/hosts
sudo vim /etc/hosts
and add you APP_ALIAS to the hosts for 127.0.0.1
127.0.0.1 localhost APP_ALIAS APP_ALIAS2
5. you app/webroot/index.php should look similar to this:
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
* Each define has a commented line of code that explains what you would change.
*
*/
if (!defined('ROOT')) {
define('ROOT', DS.'home'.DS.'kabturek'.DS.'workspace'.DS.'cake_apps');
//You should also use the DS define to seperate your directories
//define('ROOT', dirname(dirname(dirname(__FILE__))));
}
if (!defined('APP_DIR')) {
define('APP_DIR', 'tumble');
//define('APP_DIR', basename(dirname(dirname(__FILE__))));
}
/**
* This only needs to be changed if the cake installed libs are located
* outside of the distributed directory structure.
*/
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define ('CAKE_CORE_INCLUDE_PATH', DS.'home'.DS.'kabturek'.DS.'usr'.DS.'lib'.DS.'cake'.DS.'1.2.x.x');
//You should also use the DS define to seperate your directories
//define('CAKE_CORE_INCLUDE_PATH', ROOT);
}
that should be it ;)