DescriptionDocumentationExamplesLinksLicenseFuture plansDevelopersDownloads
Flag Flag

If you like this script, please rate it at:

Cíclope project logo



Operating System

This library has been developed and tested under GNU/Linux (Gentoo Linux) and Windows XP SP1 operating systems on Intel x86 plataform using latest version of both Apache web server and PHP (currently Apache 2.0.52 and PHP 4.3.10). application version to test document conversion is actually 1.1.4.

If you test it under another different operating system/plataform, please write me and let me know your experiences.

Software needed


To install this library, just download and unpack the package in a directory you want.

Note for Gentoo Linux users.

As an alternative method to install the library, Gentoo Linux users can also download the current ebuild and uncompress it into the <portage's overlay directory>/www-apps directory. Then you only need to type from a console (as root): # emerge phpdocwriter This command will download and install PHP Docwriter at /usr/share/webapps/ and at your default virtual host location (usually /var/www/localhost/htdocs/). After this, you can install the library for any other virtual host if you want by typing: # webapp-config -I -h <host> -d /mywebapp/libs/ phpdocwriter 0.3 For more information see the webapp-config(8) man page.

If you only want to create XML documents, you can skip the next section (Document conversion), because there is nothing else to install or configure.

Document conversion

As we explained already, this library can only generate XML documents (that is, StarOffice/ documents). Once the document has been generated, it can communicate with application in order to such application do the conversion to another desired format.

This export function uses the Python-UNO bridge included with distribution and installed by default from version v1.1RC3 though I recommend to install the last one (v1.1.4). You don't need to worry about python installation because comes with its own python 2.2.2 runtime.

This method follow the client-server architecture, you need at least one installation (working as client and server) or one installation working as client (the machine where PHP DocWriter runs) and other installation working as server (the machine that converts documents).


For this version of classes, client and server needs to be the same machine.

Configuration at the server side
  1. Close all instances (even the quickstarter).
  2. To make listen only for one session execute from shell: # <OfficePath>\soffice "-accept=socket,host=localhost,port=2002;urp;"
  3. To make listen whenever it is started, open the file <OfficePath>/share/registry/data/org/openoffice/Setup.xcu in an editor, and look for the element <node oor:name="Office"/>. This element contains <prop/> elements. Insert the following <prop/> element on the same level as the existing elements: <prop oor:name="ooSetupConnectionURL" oor:type="xs:string"> <value>socket,host=localhost,port=2002;urp;</value> </prop>

    This setting configures to provide a socket on port 2002, where it will serve connections through the UNO remote protocol (urp).

    Note on Linux machines. application need a X session to run. If you are a console user, you need to create a new one. To do it, from a console type # nohup /usr/X11R6/bin/Xvfb :25 -screen scrn 800x600x32 & to start a new session.
    Don't forget to export DISPLAY variable # DISPLAY=":25" <OfficePath>\soffice "-accept=socket,host=localhost,port=2002;urp;" And use # /usr/bin/killall Xvfb when you want to kill the X session.
Configuration at the client side

At the client side you need to fill in several files with the with appropiate values.

  1. Edit the file conf/config.php and change the value of the constant pdw_tmpdir (only if necessary). This constant must contain a valid path of a temporary directory where PHP DocWriter could write/read temporary files (this files are created during the process of conversion).
  2. Edit also the export script file (conf/export.bat for windows, conf/ for linux). You have to fill in two paths, pyhton executable path (something like <OfficePath>/program/ and python script file path (absolute path to file).