Ive managed to get Joomla 3.2 running on Google App Engine (GAE).
How to get Joomla! running on Google App Engine
Before we start, please do this simple tutorial to understand the basics of GAE: https://developers.google.com/appengine ... troduction
1. Install Joomla elsewhere
We need to install Joomla Elsewhere and copy the installed joomla into a new folder called joomla (/root/joomla/) in your GAE root folder, since Google App Engine has no read/write access to the filesystem. The same goes for the MySQL - after succesful installation, make a dump and use it on a local mysql.
2. Create a app.yaml file:
Code: Select all
application: joomla-gae
version: 1
runtime: php
api_version: 1
handlers:
- url: /(.*\.(htm$|html$|css$|js$))
static_files: joomla/\1
upload: joomla/(.*\.(htm$|html$|css$|js$))
application_readable: true
secure: always
## Admin
- url: /administrator(.+)
script: joomla/administrator\1
secure: always
## Asset folders
- url: /media
static_dir: joomla/media
application_readable: true
- url: /images
static_dir: joomla/images
application_readable: true
## Template folders
- url: /templates
static_dir: joomla/templates
application_readable: true
- url: /administrator/templates
static_dir: joomla/administrator/templates
application_readable: true
## SEO robots
- url: /robots.txt
script: joomla/robots.txt
## Site access
- url: /(.+)?/?
script: joomla/index.php
secure: always
Code: Select all
google_app_engine.enable_functions = "php_sapi_name, gc_enabled, libxml_disable_entity_loader"
allow_url_include = "1"
- Disable SEF and SEF rewrite
- Disable mail (for now - on GAE we need to use their mail infrastructure)
- Update the mysql connection settings
- Cache Handler = 'memcache';
5. Edit /libraries/joomla/language/language.php
Add libxml_disable_entity_loader(false); to /libraries/joomla/language/language.php line 1354
Code: Select all
// Try to load the file
libxml_disable_entity_loader(false); // add this line
$xml = simplexml_load_file($path);
This part is quite a hack. Since joomla uses jImport to require the classes, its possible to define the class in the index.php file before the $app = JFactory::getApplication('site'). This way we override the default class with the below dummy class, that does not anything to the filesystem (which is not possible on GAE).
Code: Select all
// HACK: OVERRIDE - we do not want the filesystem based logger
class JLogLoggerFormattedtext extends JLogLogger
{
public function __construct(array &$options){ parent::__construct($options); }
public function __destruct(){}
public function addEntry(JLogEntry $entry){}
protected function generateFileHeader(){}
protected function initFile(){}
protected function parseFields(){}
}
/root/app.yaml
/root/php.ini
/root/joomla/
8. Cloud SQL
We need to create a MySQL server and database in order to make joomla work.
You need to start by reading this: https://developers.google.com/appengine ... cloud-sql/
- Create a sql instance, and add your GAE app in the Authorized App Engine Application.
- By default, the user root with no password can access the Cloud SQL. You can use this for testing.
- Now you need to import the sql dump from the old joomla installation. This is done by using a Google Storage Bucket. Read the instructions here: https://developers.google.com/cloud-sql ... rt#migrate
You can use the below script to test if you have access to the Cloud SQL server from GAE.
Code: Select all
// test script
mysql_connect(":/cloudsql/instance:database", "root", "") or die ("Could not connect to server");
mysql_select_db($db) or die ("Unable to select database!");
$result = mysql_query("SELECT name, element FROM josgae_extensions");
while(list($name, $element) = mysql_fetch_row($result)) { echo $name." ".$element."<br/>"; }
mysql_close();
Code: Select all
appcfg.py update /rootfolder/
Thats it. It should work now.
Hope you all got it working by now!