Google App Engine
Feedback on this document

Installing the PHP SDK on Linux

Installing the App Engine SDK for PHP on Linux

The SDK includes software for a web server that you can run on your own computer to test your PHP applications. It also includes software to upload your application to App Engine when you are done testing it locally.

In order to use the App Engine PHP SDK on your Linux-based computer, you must install the following software:

  1. Python 2.7
  2. PHP 5.4
  3. App Engine PHP SDK
  4. MySQL 5.5

Installing Python 2.7

You will need Python 2.7 to use the App Engine PHP SDK. Fortunately, it is installed by default on most Linux systems. You can verify your Python installation using the following command:

  /usr/bin/env python -V

If the output looks like Python 2.7.<number> then you already have the correct Python version installed. Otherwise you will have have to look at the installation instructions for your Linux distribution.

PHP

The PHP SDK requires version 5.4 of the php-cgi binary.

PHP 5.4 is not packaged on most Linux distributions so it may be easiest to install it from source. On Debian-based Linux systems, you can use the following commands to install PHP 5.4 in such a way that it won't effect any other versions of PHP that you may have installed:

  sudo apt-get install gcc libmysqlclient-dev libxml2-dev
  wget --trust-server-names http://us2.php.net/get/php-5.4.15.tar.bz2/from/us1.php.net/mirror
  tar xjf php-5.4.15.tar.bz2
  cd php-5.4.15
  ./configure --prefix=$PWD/installdir --enable-bcmath --with-mysql
  make install
  cd -

At this point php-cgi (the binary used by the PHP SDK) can be found in php-5.4.15/installdir/bin/php-cgi.

SDK

  wget http://googleappengine.googlecode.com/files/google_appengine_1.8.8.zip
  unzip google_appengine_1.8.8.zip

MySQL

Google Cloud SQL is a MySQL database that lives in Google's cloud. Google Cloud SQL is used by the App Engine PHP applications to permanently store their data.

In order to test your application locally, you must install MySQL on your computer. On Debian-based Linux systems, you can use the following command:

  sudo apt-get install mysql-server-5.5

You will be prompted to enter a password for the MySQL root user, make sure that you remember it.

Next...

The PHP SDK includes a local development environment that lets you develop and test complete App Engine applications before showing them to the world. Let's write some code.

Continue to Hello, World!

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.