Google App Engine PHP SDK - How to install on Ubuntu (15.10)?

不问归期 提交于 2019-12-06 08:57:50
ojrask

That GAE PHP extension seems like a quite new thing. Don't remember using it on the SDK in Ubuntu 14.04.

You need to build PHP and that extension from source. You should grab the latest PHP5.5 branch from their source repo (http://php.net/git.php) and build it. That linked page contains instructions on building PHP but the procedure is similar to the following:

$ git clone <php-src> 
$ cd ./php-src/ 
$ git checkout PHP-5.5
$ ./buildconf
$ ./configure --prefix="/opt/php55"
$ sudo make && sudo make install

And remember to pick the modules and packages you want to compile with PHP5.5 to be used in the SDK. I think Google had an official list of modules and extensions they use inside GAE PHP and inside the SDK PHP. The prefix argument tells the compiler where to install the resulting application.

Then you need to get that source for the PHP extension and build it

$ git clone https://github.com/GoogleCloudPlatform/appengine-php-extension
$ cd appengine-php-extension
$ phpize # remember to use the phpize from the just built PHP5.5 binaries
$ ./configure
$ sudo make && sudo make install

(That Git repository contains detailed building instructions so you should probably refer to them when building.)

Enable the resulting .so for the PHP5.5 you just built using the PHP configuration files.

After that you need to install the PHP SDK and configure it to use the newly built PHP binary

$ dev_appserver.py <...> --php_executable_path=/opt/php55/bin/php-cgi

The SDK will let you know if the built PHP binaries are incompatible with the SDK version you use. I remember compiling the PHP from source around 5 times before it worked without any warnings.

But essentially they are telling you to compile PHP from source, then compile their extension from source and then use the built PHP+extension with the downloaded SDK. These instructions are from the top of my head so you may need to adjust the commands and procedures.

The process can be simplified by using Docker, here is an image you can use: https://hub.docker.com/r/mhariri/docker-google-appengine-php/

To run your app, you just need docker installed, and then run the following command in your app directory:

docker run -it -v $(pwd):/app --rm --net=host mhariri/docker-google-appengine-php
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!