Install CakePHP 2.7.9 on Google App Engine

I build apps on GAE using Codenvy from a Chromebook, so I need a process for CakePHP installation that can be done without a local webserver and without using Composer. I am much indebted to my colleague Murshed Ahmmad Khan and this excellent but perhaps a bit outdated post by M.J. McConnell to figure this all out. Here are the steps to load a clean release.

  1. Create the project on GAE, with the MySQL instance your_sql:your_instance
  2. Create the storage bucket named including verifying to Google that you control that domain by following all the steps to upload the special googlennnnnnn.html file into my app/webroot/files folder, and deploy it to serve on your app with the lines:
     - url: /googlennnnnnnn.html
       static_files: app/webroot/files/googlennnnnnnn.html
       upload: app/webroot/files/googlennnnnnnn.html
  3. Download the source zip file from
  4. Upload the zip file to Codenvy, telling it to exclude the root folder when it unpacks it.
  5. Edit app.yaml like the example below.
  6. Create a php.ini file as shown below.
  7. Follow the instructions at this link to download DebugKit from and install it into the app/Plugin folder (not the “plugins” folder in the root area) using Option A (download) for Step 1. Tell it to NOT exclude the root folder, which you need. Edit the bootstrap.php folder uncomment the “CakePlugin::loadAll(); ” line to ensure you’ve got DebugKit loaded no matter what the name of the folder is (on mine, it was debug_kit-master).
  8. Make a batch of edits to Config/core.php to change how storage and logs are handled:
    1. Change the $engine assignment to be $engine = ‘Apc’;
    2. Change the Configure::write commands for Error and Exception for ‘log’ from ‘true’ to ‘false’
  9. Edit Config/bootstrap.php:
    1. Change the default cache line to read Cache::config(‘default’, array(‘engine’ => ‘Apc’));
    2. Change the final two sections on logging to use Syslog instead of Filelog.
  10. Edit webroot/index.php by adding these lines at the top.
    //Change the default TMP Folder path to a Cloud Storage Bucket
    if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
     define('TMP', "gs://");
  11. You can now run it — you’ll see errors about fixing the security.salt and security.seed in core.php. Obey those commands. By visiting to get good random alphanumeric and numeric strings.
  12. Next – rename Config/database.php.default to Config/database.php, ignore the host setting and add the line ‘unix_socket’ => ‘/cloudsql/your_sql:your_instance’
  13. Bake the Cake! You cannot run the command line utilities to automatically generate your scripts, but you can use a wonderful online tool that will generate the Model, View and Controller files you need in ready-to-upload zip folder at

Contents of php.ini

; Enable php core functions
google_app_engine.enable_functions = "php_sapi_name, php_uname, gc_enabled"
; Load Google Cloud Storage Buckets here
google_app_engine.allow_include_gs_buckets = ""
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

Contents of app.yaml

application: your_app
version: 1
runtime: php55
api_version: 1
threadsafe: yes
- url: /css
  static_dir: app/webroot/css
- url: /js
  static_dir: app/webroot/js
- url: /img
  static_dir: app/webroot/img
- url: /favicon\.ico
 static_files: app/webroot/favicon.ico
 upload: app/webroot/favicon\.ico
- url: /.*
  script: app/webroot/index.php
  login: required
- url: .*
  script: app/webroot/index.php
  login: required


One thought on “Install CakePHP 2.7.9 on Google App Engine

Comments are closed.