PHP Adventures with Google App Engine (Part 4)

Then I got the bright idea to just slap the WordPress code into a GAE PHP+pQg Project to see what happens…

This is how I approach this sort of task…  Just Do It !

I have been in job interviews where I said something like, “…why not just slap the code in there to see what happens…”. And I was met with snickers and laughs…  if only they knew how completely effective doing that would be… the joke is on them.

By the time I am done, cleaning-up all the obvious errors I will know exactly and precisely what it took to make WordPress 3.1.3 work in a GAE+pQg project.  Then all I need to do is a DIFF via SVN and bingo, I know exactly how to patch WordPress 3.1.3 for others to use via an automated script.  All I need to do is be present for the process…

After a bit more than 2 years of waiting for others to get this done… it seems, I do know the process after-all.

Easy, peasy !

Just Do It !

Stay tuned, folks, WordPress 3.1.3 is heading for GAE sometime soon – well sooner or later, depending on how much time I can pump into this task.  Either way, the GAE SDK will tell me how to get this done, one step at a time.

Proof of Life, right from the GAE SDK for Java !

http://localhost:8888/wordpress/ <– this is where I begin…

Got this right away after just slapping the stock WordPress source for 3.1.3 into the GAE+pQg Project from earlier in this series.

All I need to do now is watch the errors and pick-up the pieces – the SDK will tell me what I need to do, indirectly…

Get rid of references to wp-config.php

So far there will not be a need to look for this “wp-config.php” file when running in the GAE…  gotta make a change there.

And then…

Followed by…

Hmmm… now what should I do this all this ?

Doing this will cause some errors… but what the hay, no harm and no foul… right ?

Wondering what happens next ?!?  So am I !!!

DUH !!!

Now, who didn’t see this one coming ?!?

Time to get some work done on this little problem…

And then I found that one PHP file where all the Db action lives…  Wonder what I can do with this ?  Hmmm ?!?

Keep in mind, I am as causal a PHP coder as anyone might ever care to deal with… But PHP via Java and this does appeal to my sense of irony. Doubly so when it lives in GAE !

Some Analysis

This whole problem of getting WordPress in the Google Cloud would not even exist if the silly WordPress coders had thought to build a nice Abstract Interface through which Database operations are being handled.  On the other hand, maybe this was done and it is simply not all that obvious to me – either way, this is not an overly complex problem.

The nice Abstract Interface I am talking about could have been as easy as having used an nice ORM.  Had WordPress been coded using Python and Django all this could have been over and done already because there would not be an issue of getting WordPress into GAE.  Oops, now you all will think I am biased – darn !

In any case, there is no such thing as a dead db when dealing with GAE !

Making Progress… Onto the next Error of many !

Hmmm…. This might just be a nice time to initialize the Tables using pQg but I think I will get past this one before working that one out.

Just to Recap…

By now I have a method for knowing when, in a crude way, WordPress 3.1.3 is running in the GAE and I have by-passed the first two issues…

(1). It don’t matter whether or not the Db can provide a Connection – GAE’s Database is always online, or so the assumption goes for now.

(2). It don’t matter whether or not the select method does anything or not – much of this sort of thing will be moot when running in GAE.

All this will be refined going forward but for now I just need a crude method for getting there.

Hmmm… PHP Debugging Support Sucks for GAE !

Good thing I have Zend Studio 7.x with a lifetime license.

Guess I need to see where the code goes after those two issues get by-passed…  this is where we separate the men from the boys… I am not one of the boys… LOL

Got Past all this !

Looks nasty, doesn’t it ?  I thought so too for about 10 secs… then I got over it while watching the Star Trek Marathon on SyFy Channel.

Soon as I put in just a bit of code from the previous steps I am now getting something much happier from WordPress 3.1.3 !

It is almost as-if I might just know what I am doing, huh ?!?

Adding my own flair to the process…

Imagine a guy, like me, with more than 3 decades of software development experience having more than enough PHP experience to get the job done with PHP but… I don’t even like PHP and here I am doing what the rest of the PHP coders on the planet have not been able to get done with the latest WordPress 3.x in the GAE !!!   Of course, I have spent more than a casual amount of time doinking around with PHP and WordPress – I even toyed with the idea of recoding WordPress using Django but that was way too involved to matter.

Once I get this done and working I will be LOL all over the place all the while I am building a slick little online web based system for replicating this process for the rest of the world for a small nominal fee, of course.

So who in the room didn’t see this one coming ?

To be expected… LOL

This is a most curious warning…

Fatal Error: ‘wp_die’ is an unknown function.

This one popped-out along the way… this feels like a sleeping bug in the mainline WordPress 3.x codeline.  I am fixing it in my patch for GAE.


PHP Adventures with Google App Engine (Part 3)

Sample Project for Google App Engine 1.5.0

You can download this sample project. Working Quercus with working pQd installed and ready to roll.

As always, some assembly may be required to fit your specific needs.  It’s pretty easy to get to this point for those who know where to find the information.

WordPress 3.1.3 for Google App Engine

At first blush, it seems to me, it should be pretty easy to do pretty much whatever anyone might want to do with WordPress simply by making some changes to one single PHP source file which in this case would be the wp-db.php file.  This one file handles SQL interactions for WordPress, generally for MySQL however any Db could be used including but not limited to some kind of REST interface in place of MySQL.

Why there are no ORM’s for PHP such that those who maintain the WordPress Source would not have wanted to use one is a mystery to me but then I would want to use an ORM just to make it easier to connect to a different Db just in case that might become an option.  A bit of research indicates there are some ORM’s for PHP however none of those made their way into the WordPress PHP source code.

Level of Effort for Maintenance of Google AppEngine Patch for WordPress

Assuming all the changes get made to the wp-db.php file and none are required in any other files… the level of effort to maintain this level of functionality for Quercus and the Google App Engine would be minimal and should pose no problems going forward.  My interest lies in creating an automated tool I could monetize such that anyone could upload and install the latest version of WordPress in the Google App Engine… well this speaks for itself.  I would personally love to see millions of people using the Google App Engine for this one purpose alone and if I could make a buck for each installation that would be gravy.  I am just amazed Google has not done this already.

This may become more than just a weekend project just to get WordPress 3.1.3 into the Google Cloud but it is at-least more than possible.


PHP Adventures with Google App Engine (Part 2)

Yet another success.

Installed jRuby 1.6.2 !

Integrated pQg into Quercus for Google App Engine and it works !!!

What’s next ?

Try to get WordPress 3.1.3 working with pQg and Quercus !!!

If this works, I might work on a slick installer to allow all those who want to use this get their own WordPress 3.1.3 site working in the Google App Engine.

There are some other techniques I could use to accomplish this goal other than to use Quercus and pQg however those techniques would require more time than simply hoping standard SQL can work with the Google App Engine for PHP via Quercus.  I am still hoping this little project won’t grow to consume my entire life other than just this weekend, until the time comes to whip-up a slick installer I can use to make some money from – like I said, I got bills to pay too and based on my Research it’s no easy thing to get WordPress running in the Google App Engine even after 2+ yrs have gone by since this was originally done so since nobody else has thought to use the same techniques I am using why not try to make some coin off this thing if possible.


PHP Adventures with Google App Engine

Proof of Life !

The last time around with a previous version of Quercus I had the following running in GAE:

This time around, with the latest Quercus I have the following almost ready to upload:

The purpose for all of this, other than the entertainment value, is to make a stab at getting a stock WordPress 3.1.3 running in the Google App Engine, just for fun and to see if I can run a blog there at no cost.

I may even whip up a little installer program that knows how to upload all this for others to use for a small nominal fee payable to me of course.  Hey, I got bills to pay too…

All the more entertainment, for me more than you, is that I am running this with jRuby at the moment – LOL.

Even more entertaining is the fact that Quercus is supposed to execute PHP faster or as fast as the C version of PHP all the while using Java to get the work done.  Funny, more for me than you… LOL

Letter to Google…

My greatest interests are with Python (5+ yrs spread over the last 10+ yrs) and Android (2+ yrs) and whenever I can do both at the same time (and believe me I have tracked down the tools for doing this) I am right there doing what I can.

…Universal World-Wide Geotagging is my current pet project with a keen eye on making it easy for poor slow Hadoop to retrieve data elements for any region or area of interest driven by Google Maps, of course.  I would want to replace Hadoop with pyTables Pro but then I think Bid Data is all about performance rather than not and for some odd reason Python seems to blow right past whatever Java thinks it can do, in my experience.

I think I can Geotag anything using nothing more than 16 bytes (more or less) of metadata all the while never needing to do any complex computations (Haversine) when retrieving data; driven by whatever area or region a user may be viewing via Google Maps.  This plus a couple well-placed indexes and users can view heat maps in real-time, updated whenever the Map changes in any way.

I am, of course, a huge fan of the Google App Engine and I enjoy using it to the extent possible and then some – these days I am lifting the limits one at a time just to see if I can.  The most recent GAE Limit I lifted was the outgoing GMail limit – now I can easily send more than 2000 emails a day without having to enable billing.

I think I would enjoy the opportunity to build a Cloud based on Stackless Python along with some other nifty Python Tools I have been collecting over the past 5+ years.  Stackless Python + pyTables + Psyco + Cython + Parallel Python  + Some_Work = Cloud with some cool capabilities others have not yet touched on.  I would love to see what happens once people are able to turn persistent Tasklets loose in an Elastic Cloud with distributed data and distributed processing.  In the meantime, I am enjoying what I can do with GAE.


More Android Adventures

Getting some good downloads just from word of mouth and no advertising while working on the back-end to make sure I won’t have to pay any money to Google for the Google App Engine.

BTW – I now have a slick method for ensuring only 2000 emails per day are sent by aggregating over a 1 week period; all excess emails are shunted to a PHP Script running on a low-cost resource I have secured in 5 year intervals (unlimited bandwidth and unlimited disk space, yeah – one of those…).

See the status:

World-Wide Universal Geotagging !!!

Geotagging is a method of tagging data (images, videos, music or just plain old data) with metadata sufficient to allow the tagged data to be located based on GPS Coords (Lat,Lng).

I am presently working on a Universal Method for Geotagging Data in such a manner so as to allow tagged data to be found based on a Region, any arbitrary Region, such as one that has been defined by the ViewPort for Google Maps (for instance) or any other arbitrary location defined by a GPS Coord (Lat,Lng).

My Universal Geotagging Method, for lack of a better name for it – I tend to call things what they are, this may be a character flaw for me but it seems to work for me well enough…, allows me to locate whatever has been tagged based on the Region the user has interest in.  A Region can be thought of as a ViewPort for Google Maps such as any Viewable area on any world map.

Once I have completed my work I intend to use it to catalog every single molecule in the known universe beginning with Earth.  LOL.

Actually I am doing this for one of my clients who seems to have a keen interest in knowing how to handle this sort of thing for their rather huge Hadoop data stashes.  Needless to say, the method I am using does not use Java because as we all know – Java is just not the fasted kid on the block even though all those benchmarks seem to want to tell us Java is supposed to be really darned fast – NOT IN REAL LIFE !!!

Obviously I was told Python is being used to massage their data before it gets into Hadoop…  and I am ROFL at knowing this to no end.  You should see what I can do with Python once I set my sights on making all that data fly into Hadoop with my Universal Geotagging Method applied to every single data element that has a GPS Coord (Lat,Lng).

Gotta get back to work now.  Man, I am really having fun now !!!

%d bloggers like this: