I was wondering if there are any best practice web sites on using PHP on 
Google App Engine.

While working through installing the Joomla! CMS on GAE I've run into some 
weird oddities and initially have taken a rather brute force approach to 
work through them.

Being unhappy with the brute force method[which requires modifying core 
files in the open source code in order to accommodate GAE] I have continued 
to cycle on it in the back burner and am trying an alternate approach right 
now.

Specifically, in Joomla there are 3 main entree points to an application:
http://mydomain.com/index.php
http://mydomain.com/administrator/index.php
http://mydomain.com/installation/index.php


So far I've run into 2 issues:
1) Joomla uses XML files in order to define html form's.  PHP is used to 
parse those files and then build the forms.  GAE disables the ability to 
load /remote/ XML files in PHP by default.  It is possible to allow this by 
add libxml_disable_entity_loader to the list of enabled functions and then 
to call libxml_disable_entity_loader(false); at some point in the code. 
 For some reason, despite the fact that these are LOCAL xml files Jooma 
attempts to read, I still need to use this fix to allow Joomla to read the 
local files.

2) Joomla defaults to saving sessions in files, GAE defaults to saving 
sessions in memcache.  Attempt to save session files using the default 
save_path does not work since the path does not exist.  Making a small hack 
to make memcache the default does not work because Joomla checks for the 
existence of the Memcache extension[via extension_loaded()] which does not 
exist in GAE.   A slightly more involved solution required me adding a new 
GaeMemcache class to override that check, and modifying a core class to 
force it to enable GaeMemcache.

None of this is bad...it's just inelegant and messy.

It strikes me that this was the wrong way to go about it.  Because of the 
way GAE is configured through app.yaml to match URI patterns to individual 
php files - instead of changing the core code, I can instead provide a 
pre-loader to process the file.

So my new file structure will be as follows:
/gae/joomla-site.php
/gae/joomla-install.php
/gae/joomla-admin.php
/gae/lib/gaememcache.php
/gae/appl.yaml
/joomla-cms : submodule git repository pointer for the Joomla-CMS repository


With this layout, I can now define my 3 entree points so that instead of 
loading the various index.php files directly, I can proxy the call first by 
the /gae/joomla* php file.  That gives me the ability to make any Google 
App Engine modifications needed[defining a special memcache handler for 
GAE, making my libxml_disable_entity_loader function call - etc.  No core 
hacks needed - now I can just setup a special pre-processors to handle 
everything.

The configuration ability of GAE is extremely fascinating..  In many ways 
it is overly cumbersome for simply usage due to the options available - but 
the options also allow for neat little workarounds[I also realized that 
instead of hacking the core file, I could have made a copy of the core file 
under my gae directory and used the upload path overrides to overwrite the 
core files only when uploaded/deployed to GAE]

What I am somewhat curious about is if there are any best practices 
tutorials out there since this sort of situation seems like it should be 
common, and the various answers are intuitive once you start groking the 
GAE deployment system.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to