I have PHP running on Google App Engine – How do I use a DB?
I followed PHP on the Google appengine to setup and it works great. Any suggestions on how to use a database / datastore with PHP on GAE?
如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

评论(5)

It is using an incomplete implementation. It is a good starting point if you are serious about using google datastore.

There's some discussion on a GQL datastore in the tutorial you just linked to.
Google App Engine’s datastore has a SQL-like syntax called “GQL”. Select statements in GQL can be performed on one table only.
And memcached
anyway for the php to access any kind of database. - I know that Memcached is provided by GAE so we can use that by simply adding a key value pair.

I think this is what you are looking for
https://developers.google.com/appengine/docs/php/cloud-sql/
use one of the three MySQL libraries supported, work against local installation of MySQL in local, and the Google CloudSQL when deployed, by having an instance name that you connect to with mysql_connect(). Requires billing being enabled to setup a CloudSQL instance :-(


Because Google provides low-level access to the datastore in Java API
You should be able to access those class using the php-java integration, something like:
// Get a handle on the datastore itself
$datastore = new Java('com.google.appengine.api.datastore.DatastoreServiceFactory')->getDatastoreService();
// Lookup data by known key name
$userEntity = $datastore->get(new Java('com.google.appengine.api.datastore.KeyFactory')->createKey("UserInfo", email));
发布评论
需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。