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:
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.
The PHP SDK requires version 5.4 of the
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 bunzip2 php-5.4.15.tar.bz2 tar -xf php-5.4.15.tar cd php-5.4.15 ./configure --prefix=$PWD/installdir --enable-bcmath --with-mysql make install
You can install the PHP SDK with the following commands:
wget http://commondatastorage.googleapis.com/appengine-php/appengine-php-sdk-1.8.0.zip unzip appengine-php-sdk-1.8.0.zip
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 get mysql-server-5.5
You will be prompted to enter a password for the MySQL root user, make sure that you remember it.
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!