9

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?

konqi
  • 4,932
  • 3
  • 29
  • 50

5 Answers5

3

Because Google provides low-level access to the datastore in Java API

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/package-summary.html

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));
Randy Sugianto 'Yuku'
  • 64,635
  • 54
  • 168
  • 216
1

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 :-(

Andrew Mackenzie
  • 5,005
  • 4
  • 42
  • 61
1

see the URL below for an proof of concept how to use SQL CRUD (Create, Retrieve, Update, Delete) in PHP at Google App Engine.

Oops, new users can not post a link. Click on my name below in the right corner and then click on the website url.

0

https://gae-php-tips.appspot.com/2013/12/23/getting-started-with-the-cloud-datastore-on-php-app-engine/

https://gae-php-tips.appspot.com/2013/12/24/getting-started-with-the-cloud-datastore-on-php-app-engine-part-ii/

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

0

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.

Ólafur Waage
  • 64,767
  • 17
  • 135
  • 193