Get started with CakePHP


The CakePHP framework is installed in the frameworks/cakephp directory of the installation directory. This folder includes an example application. Application files are in the app/ directory and public files, such as HTML pages, CSS and JavaScript files, images and other media assets are stored in the app/webroot directory.

Activation and Testing

To enable the example application, edit the Apache configuration file at installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf and uncomment the following line

Include "installdir/frameworks/cakephp/conf/httpd-prefix.conf"

Then, restart the Apache server.

$ sudo installdir/ restart apache

You can now verify that the example application is working by visiting its URL using your browser at http://localhost/cakephp.

Here is an example of what you might see:

CakePHP welcome page


Before using the example application, here are a few important points to consider:

  • To secure your application, modify the encryption keys in the app/Config/core.php file. Ideally, use a key that’s 32 characters or longer in length.

    Configure::write('Security.salt', '');
    Configure::write('Security.cipherSeed', '');

    On Linux, you can use a command like pwgen 32 to generate a 32-character random key. On Windows, you can use a tool like PWGen.

  • If your application will use a database, edit the database settings at app/Config/database.php.

    public $default = array(
            'datasource' => 'Database/Mysql',
            'persistent' => false,
            'host' => 'localhost',
            'port' => '3306',
            'login' => 'user',
            'password' => 'password',
            'database' => 'database_name',
            'prefix' => '',
            //'unix_socket' => 'installdir/mysql/tmp/mysql.sock',
            //'encoding' => 'utf8',

    NOTE: If you are using an operating system that supports sockets, such as Linux or Mac OS X, you can optionally specify the unix_socket parameter in the above configuration array instead of the host and port parameters.

    MySQL support is already available by default. If you plan to use PostgreSQL, enable the php_pdo_pgsql extension in the installdir/php/etc/php.ini file.

  • To move the CakePHP example application such that it is available at the root URL of the server (without the /cakephp URL suffix), follow these steps:

    • Edit the installdir/frameworks/cakephp/conf/httpd-prefix.conf file so that it looks like this:

      DocumentRoot "installdir/frameworks/cakephp/app/webroot/"
      #Alias /cakephp/ "installdir/frameworks/cakephp/app/webroot/"
      #Alias /cakephp "installdir/frameworks/cakephp/app/webroot"
      Include "installdir/frameworks/cakephp/conf/httpd-app.conf"
    • Edit the installdir/frameworks/cakephp/app/webroot/.htaccess file so that the RewriteBase directive is set to the root URL:

      RewriteBase /
    • Restart the Apache server:

      $ sudo installdir/ restart apache

    You should now be able to access the example application at the root URL of your server.

Upgrading to CakePHP 3.x

If your Bitnami stack currently uses CakePHP 2.x and you would like to upgrade to CakePHP 3.x, follow these steps:

NOTE: The steps below assume that you have already activated the CakePHP framework and example application.

  • Log in to your server console.

  • Back up the current version of CakePHP:

    $ cd installdir/frameworks
    $ sudo mv cakephp cakephp.old
  • Download and install the latest version of CakePHP (3.0.10 at the time of writing):

    $ cd installdir/frameworks
    $ sudo wget
    $ sudo tar -xzvf 3.0.10.tar.gz
    $ sudo mv cakephp-3.0.10 cakephp
  • Create a demo application:

    $ cd installdir/frameworks/cakephp
    $ sudo composer self-update
    $ sudo composer create-project --prefer-dist cakephp/app app
  • Copy the necessary configuration files from the previous CakePHP installation:

    $ sudo cp -R installdir/frameworks/cakephp.old/conf installdir/frameworks/cakephp/
    $ sudo cp installdir/frameworks/cakephp.old/app/webroot/.htaccess installdir/frameworks/cakephp/app/webroot/
  • Change file ownerships of the CakePHP directory:

    $ cd installdir/frameworks/
    $ sudo chown -R bitnami:root cakephp

You should now be able to access the example application and verify that it is using CakePHP 3.x, as shown below:

CakePHP upgrade

More Information

Learn more about developing applications with CakePHP at

Last modification April 8, 2020