Installing CakePHP 3.0.x on Debian 7.5
The official repos have CakePHP 1.3.15, but this version is old and the CakePHP documentation for 1.3 is flaky (20140610 – 502 Bad Gateway).
To install the latest CakePHP source, we need to be running a later version of PHP than is available on the official repos, so let’s add a new repo to the /etc/sources.list file:
deb http://packages.dotdeb.org wheezy all deb-src http://packages.dotdeb.org wheezy all
Once you’ve added these repos to the file, you need to update the list of available packages:
Now you’re ready to install the packages you need from the dotdeb repo:
aptitude install php5 mysql-server php5-intl php5-mcrypt php5-mysql
In order to install composer (which you’ll need to grab CakePHP), you need to install curl and git:
aptitude install curl git
Now that’s done you can install composer:
root@debian:~# curl -s https://getcomposer.org/installer | php #!/usr/bin/env php All settings correct for using Composer Downloading... Composer successfully installed to: /root/composer.phar Use it: php composer.phar root@debian:~#
The last step is to install the CakePHP package and dependencies:
root@debian:~# mkdir php root@debian:~# mv composer.phar php/ root@debian:~# cd /var/www/ root@debian:/var/www# ls -alh total 12K drwxr-xr-x 2 root root 4.0K Jul 8 11:58 . drwxr-xr-x 12 root root 4.0K Jul 8 11:58 .. -rw-r--r-- 1 root root 177 Jul 8 11:58 index.html root@debian:/var/www# php /root/php/composer.phar create-project -s dev cakephp/app Installing cakephp/app (dev-master 05bdc480602ea7c736815f51c059f844fc26c4b5) - Installing cakephp/app (dev-master master) Cloning master Created project in /var/www/app Loading composer repositories with package information Installing dependencies (including require-dev) - Installing ircmaxell/password-compat (1.0.3) Downloading: 100% - Installing nesbot/carbon (1.8.0) Downloading: 100% - Installing cakephp/cakephp (3.0.x-dev 160f56c) Cloning 160f56c557baa5514f3781ecbf2389510f3dc9e4
I created a php directory under /root and moved the composer.phar file to tidy things up a bit. Before running the command to install CakePHP make sure you change to the directory you want to install the app into.
Make sure you set the DocumentRoot to /var/www/app (or whatever your path) and AllowOverride All so the htaccess files can be applied. You also need to enable mod_rewrite in Apache:
a2enmod rewrite apachectl restart