Forest header image

Symfony Finland
Random things on PHP, Symfony and web development

Symfony and the Google App Engine

Virtualized servers have been the norm for years now. Deploying to a VPS (Virtual Private Server) is a handy option that gives you complete control over the operating system. VPSes are preferred method for many developers and while the PaaS hype has peaked, "the cloud" is still a great option to have.

Traditional household name cloud platforms Amazon's AWS, Microsoft's Azure and PaaS services like Heroku, and Fortrabbit all have great support for Symfony:

All of the above can be a great boring humdrum hosting for an application that just needs to keep on chugging along just as long as the bills are paid. For constant tweaking and added flexibility a set of VPSes is still hard to beat.

In addition to the above options, Google has had their App Engine platform up and running since 2008. Traditionally Google has not been a very PHP focused company, with GAE supporting Python, JVM and their homegrown Go language. Even Microsoft is ahead when it comes to PHP support.

Inline with their recently revealed ambitions in growing within this service space, Google announced general availability of PHP Support for GAE in June 2015. It has not seem to sparked a lot of enthusiasm among the developer scene, partly due to this and other reasons stated here:

Developers are problem-solvers. They love to play with tech. Mastering complicated tasks is a sport to them. Every developer is building her/his own very best hosting solution, even when it takes lot's of time and the result isn't production-grade.
- Is PaaS Dead?

So regardless of whether Google's cloud revenue will eclipse their ad revenue only due to the collapse of their advertising revenue, it's a sure bet that more and more developers will be deploying to more abstracts environments than they have before. Be it the mysterious cloud, a PaaS or a Docker Container at OpenShift or other provider.

What's in App Engine for PHP and Symfony?

For developers wanting to try out PHP on the Google App Engine, they offer a tutorial for PHP which demonstrates that it's largely regular PHP with some additional services such as User Services, Static File Handling, SMS & Voice Messages and Cronjobs. Working with the development environment was effortless.

Google also offers a tutorial for Symfony Framework which seems to be a bit out of date. Largely it's still valid, but the example application documentation is a better option in my opinion. So what's special about the sample app?

There are a couple of configuration files you'll need to go through, both of these are on the root level. App.yaml contains GAE specific configurations and php.ini contains GAE service specific configurations and application specific PHP settings.

In addition to settings there is a custom front controller with small additions to check if the app is running as expected in the environment. The front controller then passes forward to the AppKernel which is modified to use the Cloud Buckets for cache and logging.

There's also an extra cache clearing script and an extension to the Symfony Environment, but other than that it's a standard Symfony structure. All in all the experience I had with the tooling and deployment for Google App Engine and PHP was better than expected. Keep up the good work!

I'll need to look closer to running a real application like eZ Platform in an environment which should allow sufficient performance for even rare use cases:

The Second Screen app performed flawlessly, with 630,000 unique visitors in just 10 hours. The app’s traffic peaked at 9,000 QPS, well within the planned capacity.
- Sony Music builds app to support YouTube’s biggest-ever music livestream event with Google Cloud Platform

Written by Jani Tarvainen on Thursday January 21, 2016
Permalink -

« PHP 7.0 is included in Ubuntu 16.04 LTS (Xenial Xerus) - What eZ Platform adds to Symfony »