Run multiple MediaWiki Using single Parsoid

As you refer the installation of visual editor and Parsoid in previous post

We can see how to run multiple MediaWiki with single Parsiod Service.

Just change the Parsoid config to handle multiple domains as below

vim /etc/mediawiki/parsoid/config.yaml

Method 1: You can try to follow this one as per the document ,

mwApis: - 
# This is the only required parameter, 
# the URL of you MediaWiki API endpoint. 
 uri: 'http://path/to/my/wiki/api.php' 
 domain: 'localhost'
# and another MediaWiki 
 uri: 'http://path/to/my/otherwiki/api.php' 
 domain: 'another domain'

for me the Method 1 was not woking , so I did in my own way Method 2

Method 2:

# For backwards compatibility, and to continue to support non-static 
# configs for the time being, optionally provide a path to a 
# localsettings.js file. See localsettings.example.js 
localsettings: ./localsettings.js

uncomment the localsettings: ./localsettings.js section

And comment all the demand and uri in the mwAPis section

mwApis: - 
# This is the only required parameter, 
# the URL of you MediaWiki API endpoint. 
#uri: 'http://path/to/my/wiki/api.php' 
#domain: 'localhost' .......

Create a new file in the Parsoid actual installed folder.

vim /usr/lib/parsoid/localsettings.js

Place the domain config here

'use strict'; 
exports.setup = function(parsoidConfig) { 
parsoidConfig.setMwApi({ uri: '', domain: 'host1', prefix: 'host1' }); 
parsoidConfig.setMwApi({ uri: 'http://host2/api.php', domain: 'host2', prefix: 'host2' });

Make sure the above values should match with your MediaWiki config , example

$wgVirtualRestConfig['modules']['parsoid'] = array( // URL to the Parsoid instance // Use port 8142 if you use the Debian package 'url' => 'http://host1:8142',
// Parsoid "domain", see below (optional) 'domain' => 'host1', // Parsoid "prefix", see below (optional) 'prefix' => 'host1' );

Now , both host1 and host2 mediawiki can access the parsoid and use the Visualeditor smoothly.

Thank You 🙂


Install Visual Editor in MediaWiki with Parsoid

If you want to know , how to install mediawiki please check my previous post.

Now download the visual editor extension in to the extensions folder

cd /var/www/html/mediawiki/extensions
tar -xvzf VisualEditor-REL1_30-61f161a.tar.gz

please check the version comparability here

As we have already place the LcocalSettings.php in the MediaWiki root folder, need add the config value to load the visual editor

cd /var/www/html/mediawiki/
vim LocalSettings.php
//place this code at end of the file 
wfLoadExtension( 'VisualEditor' ); 
// Enable by default for everybody 
$wgDefaultUserOptions['visualeditor-enable'] = 1; 
// Optional: Set VisualEditor as the default for anonymous users 
// otherwise they will have to switch to VE 
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor"; 
// Don't allow users to disable it 
$wgHiddenPrefs[] = 'visualeditor-enable'; 
// OPTIONAL: Enable VisualEditor's experimental code features 
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1; 
$wgSessionsInObjectCache = true;
$wgVirtualRestConfig['modules']['parsoid'] = array(
    // URL to the Parsoid instance
    // Use port 8142 if you use the Debian package
    'url' => 'http://localhost:8142',
    // Parsoid "domain", see below (optional)
    'domain' => 'localhost',
    // Parsoid "prefix", see below (optional)
    'prefix' => 'localhost'
$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;

Make sure you have these tow lines , if your wiki is going to be PRIVATE
$wgSessionsInObjectCache = true;
$wgVirtualRestConfig[‘modules’][‘parsoid’][‘forwardCookies’] = true;

These reference document may not have it
Other wise will through 403 Error while editing the article in MediaWiki.

DONT check the edit option now, it won’t work as expected, need to install & configure the Parsoid to make it work properly.

To install this add the parsoid report

sudo apt-key advanced --keyserver --recv-keys 90E9F83F22250DD7
sudo apt-add-repository "deb jessie-mediawiki main"
sudo apt update && sudo apt install parsoid

Once the installation is done , you can see the service is up and running ,
check by cmd sudo service parsoid status
and in the browser http://localhost:8142

Ok, Let configure the parsoid and link with mediawiki
open the parsoid config file

vim /etc/mediawiki/parsoid/config.yaml

Update the config section only if your wiki is going to be PRIVATE,

 conf: # /!\ COMPATIBILITY for Parsoid 0.9.0 with MediaWiki before 1.31
    strictAcceptCheck: false

Configure you domain and url

     uri: 'http://localhost/mediawiki/api.php' 
     #domain: '' # optional

Restart the service once sudo service parsoid restart

That’s it , It should work now as expected 🙂

MediaWiki On Ubuntu

Today I have tried to install Mediawiki in EC2 instance with below steps

Which requires following packaged pre-installed apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring and should bee enabled

sudo apt-get install php-curl
sudo phpenmod mbstring 
sudo phpenmod xml 
sudo systemctl restart apache2.service

Download the MediaWiki source in to you /var/www/html

cd /var/www/html/ 

Use sudo if necessary. And extract the tar as

tar -xvzf mediawiki-1.30.0.tar.gz

This extract the files as folder, after that you can remove the mediawiki-1.30.0.tar.gz or can keep for now and will delete after the setup is completed.

Create a Database in Mysql , which is require before proceed to next step.

open the url in browser http://localhost/mediawiki , which will go through one time installation process.

At final , you have to download the LocalSettings.php and place it in to the root folder of mediawiki(/var/www/html/mediawiki)

All good, will see how to integrate visual editor in media wiki in next post.

You can check here for insertion of other operating systems.

#1267 – Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation ‘=’

This error is because of different charset for tables in the database. To fix this, make the database and tables are same charset.

To change your database
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_general_ci;

Then to change your table
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

All Set Good To Go 🙂

Take Photos with Ionic

Install Plugin first 
$ ionic cordova plugin add cordova-plugin-camera $ npm install --save @ionic-native/camera

include in app module


import { Camera } from ‘@ionic-native/camera’;

providers: [


in html

<button ion-button (click)="capture()">Lets take a picture!</button> <img [src]="captureDataUrl" *ngIf="captureDataUrl"/>

in ts create capture function

import { Camera, CameraOptions } from ‘@ionic-native/camera’;

captureDataUrl: string;

constructor(private camera: Camera) { }

const options: CameraOptions = {
quality: 100,
} => {
// imageData is either a base64 encoded string or a file URI
// If it’s base64:
captureDataUrl = ‘data:image/jpeg;base64,’ + imageData;
}, (err) => {
// Handle error

That’s it, run the app in android device, wont work on browser as it require camera.

DB Dump using JAVA

package dbsync;

import javax.swing.JOptionPane;

* @author mr
public class dbsync {

* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
public static void Backupdbtosql() {
Process p = null;
String dbName = "dbname";
String dbUser = "root";
String dbPass = "password";
try {
CodeSource codeSource = dbsync.class.getProtectionDomain().getCodeSource();
File jarFile = new File(codeSource.getLocation().toURI().getPath());
String jarDir = jarFile.getParentFile().getPath();
String folderPath = jarDir + "/backup";
File f1 = new File(folderPath);
String savePath = f1.getAbsolutePath() + "/backup.sql";

Runtime runtime = Runtime.getRuntime();
//for linux or where mysql is global access
//p = runtime.exec("mysqldump -u"+dbUser+" -p"+dbPass+" –add-drop-database -B "+dbName+" -r " +savePath);
//for windows
p = runtime.exec("C:\\xampp\\mysql\\bin\\mysqldump.exe -u"+dbUser+" -p"+dbPass+" –add-drop-database -B "+dbName+" -r " +savePath);
//change the dbpass and dbname with your dbpass and dbname
int processComplete = p.waitFor();

if (processComplete == 0) {

System.out.println("Backup created successfully!");

} else {
System.out.println("Could not create the backup");

} catch (Exception e) {