Linode Library Home
Linode Library RSS Feed
Home :: Frameworks
Print View View Source

CakePHP on Debian 5 (Lenny)

Published: by

Warning

This document is an older, unmaintained guide. There may be a new guide available for this software.

CakePHP is a framework used to develop PHP applications quickly. Many people choose CakePHP because of the simple deployment process and extensive documentation available on the CakePHP website.

Before installing CakePHP, we assume that you have followed our getting started guide as well as our LAMP guide. If you're new to Linux server administration, you may be interested in our using Linux document series, including the beginner's guide and administration basics guide.

Contents

Installation

For this guide, we'll be installing the latest version of CakePHP, which is currently at 1.2.6. Make sure you download the latest version of CakePHP by checking the CakePHP website. Issue the following commands to install CakePHP on your Linode:

cd /srv/www/example.com/public_html
wget http://github.com/cakephp/cakephp1x/tarball/1.2.6
tar xvfz cakephp-cakephp1x-1.2.6-0-gbe7ddfb.tar.gz
rm cakephp-cakephp1x-ef18ab2.tar.gz
mv cakephp-cakephp1x-ef18ab2/ cake_1_2
chown -R www-data:www-data cake_1_2/app/tmp/

At this point, your installation of CakePHP is considered to be deployed for development purposes. You can now begin developing CakePHP applications. If you're using your domain for a single CakePHP application, continue following the guide to deploy CakePHP in production mode.

Production

The transition from a development installation of CakePHP to a production installation is easy. After following the steps above, open the Apache configuration file for the website you're installing CakePHP to. In our example, this file is located at /etc/apache2/sites-available/example.com. You'll need to change the DocumentRoot to reflect the path of the application in CakePHP, which in our example is /srv/www/example.com/public_html/cake_1_2/app/webroot/

File:/etc/apache2/sites-available/example.com

<VirtualHost *:80>
     ServerAdmin squire@example.com
     ServerName example.com
     ServerAlias www.example.com
     DocumentRoot /srv/www/example.com/public_html/cake_1_2/app/webroot/
     ErrorLog /srv/www/example.com/logs/error.log
     CustomLog /srv/www/example.com/logs/access.log combined
</VirtualHost>

You'll also want to adjust the debug level for CakePHP. The line controlling the debug level is in the following file.

File:/srv/www/example.com/public_html/cakephp-2.4.5/app/Config/core.php

Configure::write('debug', 2);

Change the 2 to a 0. Run the following command after saving and closing the file:

/etc/init.d/apache2 reload

You're now running a production version of CakePHP, ready for development!

Testing CakePHP

If you're new to CakePHP, you may want to begin with their 15 minute blog tutorial. You can find the 15 Minute Blog Tutorial on their manual page. Congratulations! You have now successfully installed CakePHP on your Debian Linode!

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

Creative Commons License

This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.

Last edited by Alex Fornuto on Monday, February 10th, 2014 (r4227).