Skip to content

Kolibre KADOS on Windows

Daniel Ainasoja edited this page Jan 13, 2017 · 3 revisions

This guide was provided to Kolibre in December 2016 by Sandeep Dash at Tata Consultancy Services Limited, sandeep.dash@tcs.com

Kolibre KADOS on Windows with Apache + PHP and PostgreSql

Background

The DAISY Online Delivery Protocol, developed by the international DAISY Consortium, is a web service API which enables service providers to deliver digital accessible content over the Internet directly to the end users devices and apps. In order to use Kolibre KADOS on Windows, an attempt was made by Tata Consulting Services to configure a test setup from scratch. The initial attempt to configure with PHP on Tomcat and then run Kolibre KADOS on it faced several hurdles. Ultimately below listed technology stack was locked down and ended with success.

To deploy Kolibre KADOS on Windows, below steps can be followed.

Steps given below are tested on following technology stack

  • Apache httpd server 2.4.23
  • PHP 5.5.38
  • Windows 7, 32 bit
  • PostgreSQL 9.2

Tip: For java applications hosted on Tomcat/JBOSS, Apache httpd can be configured in front of the same to leverage Kolibre KADOS services, hosted from an Apache httpd server.

Learning: Issue was faced while attempting PHP on Windows XP. It required reinstallation and/or configure Internet Explorer, since PHP complained for some missing dll files.

Deploying PHP on Windows

Although this is a topic by itself, covering some aspects may help setting up PHP on Windows quickly.

  • Download PHP zipped file

Note: Ensure to select 32bit (also known as win32/x86) or 64bit (also known as win64/x64) based on your to-be deployed environment.

Note: One more thing to consider as to select PHP thread-safe vs non-thread-safe version. PHP.net and Stack Overflow explain these considerations. For current setup, thread-safe win32 version was used.

Some important PHP configuration steps to note are:

  • No matter where you extract the downloaded zip, ensure to include the root directory (absolute path to directory containing php.exe) in the "path" variable
  • Enable below modules in php.ini file (after renaming php.ini-production or php.ini-recommended or php.ini-dist in installation root / home directory), if they are already not enabled. To enable these in php.ini file, ensure these lines are present without leading ";"
extension=php_openssl.dll
extension=php_pdo_pgsql.dll
extension=php_pgsql.dll
extension=php_soap.dll
extension_dir = "./ext"
date.timezone = Asia/Kolkata

Note: Your server timezone should be placed at the date.timezone option

Configure Apache For PHP

Assuming your basic Apache installation is configured and is service ready (see instructions here), below steps need to be carried out in order to enable php to run on Apache.

Note: Apache binaries download is not available from apache.org. Version used here was downloaded from Apache Lounge website.

  • Open httpd.conf file (inside conf sub directory of Apache installation root directory)
  • Locate LoadModule section
  • Assuming php is installed in "d:\php-5.5.38-Win32-VC11-x86", add below lines to the end of the LoadModule section,
LoadModule php5_module D:/php-5.5.38-Win32-VC11-x86/php5apache2_4.dll
AddHandler application/x-httpd-php .php
PHPIniDir "D:/php-5.5.38-Win32-VC11-x86"

Verify:

  • Create a directory "php" inside "httdocs" sub directory of your Apache installation directory; Say "info.php" with content ""
  • Start Apache (by executing httpd.exe from bin directory of Apache)
  • Open a browser and type http://hostIP:Port/php/info.php, which should show a page containing detailed information about your installed PHP and server environment

Deploying Kolibre KADOS

  • Extract Kolibre KADOS archive (zip file) inside "htdocs" sub directory (Apache application deployment directory) inside Apache httpd install direcory; Say "d:\Apache\htdocs\kados"
  • Download and install PHP Composer - This is required for installing log4php module referenced by Kolibre KADOS. Ensure that composer bin directory inside composer install directory is included in the "path" variable
  • On a command prompt, change directory to "d:\Apache\htdocs\kados" and then execute
composer.phar install

Note: This step installs log4php from Apache site that requires internet connectivity

Learning: While test run, had to add below line in service.php file to include path to log4php module

set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../vendor');

Configure PostgreSQL

  • Create a user say "kados" with password "kados"; Create a database say "kados" and schema "kados" with all rights to user "kados"
  • Run "demo.db.postgres.sql" script to create necessary tables and insert demo data

Test run

Open a command prompt, change directory to "tests" subsirectory inside kados deployed direcotry inside "d:\Apache\htdocs\kados" for example and execute

php test_client.php -s http:///kados/public/service.php?wsdl -u "kolibre" -p "kolibre"

Using Kolibre KADOS with your application

  • Read through Adapter.class.php inline documentation to understand the required methods to implement. DemoAdapter.class.php is one such sample implementation.
  • Key implementation aspects will require adapting to your custom data model and application/media file directory settings

Thanks to Kolibre Lead Developer Johan Abbors for his help in understanding the Kolibre KADOS implementation model.