Saxonica recently released Saxon/C as a beta release of Saxon-HE on the C/C++ programming platform. APIs are offered currently to run XSLT 2.0 and XQuery 1.0 from C/C++ or PHP applications. Saxon/C is built from the Java product Saxon-HE 9.5.1.5 using the Excelsior JET tool [version 9.0 (MP2)]. The current release is Saxon-HE/C 0.3.1.
Follow the instructions to set up a server on DigitalOcean:
- 111.222.333.444
- Active
- 512MB Ram
- 20GB SSD Disk
- San Francisco 1
- Ubuntu 14.04 x64
Here is a quick overview of the server setup process:
- Initial Server Setup with Ubuntu 14.04
ssh [email protected]
passwd
adduser username
visudo
vi /etc/ssh/sshd_config
service ssh restart
ssh -p 12345 [email protected]
ssh-keygen -t rsa -C "[email protected]"
vim ~/.ssh/authorized_keys
- Add SSH alias for
ocean
on localhostvim ~/.ssh/config
On my localhost, I added the following configuration to the SSH configuration file ~/.ssh/config
:
Host ocean
Hostname 111.222.333.444
User username
Port 12345
Now, it is easy to access the server via SSH by typing the following into a terminal:
ssh ocean
sudo apt-get update
sudo apt-get install apache2-mpm-worker libapache2-mod-fastcgi php5-fpm php-apc php5-gd
cd /etc/apache2/
sudo mkdir conf.d
sudo vim /etc/apache2/conf.d/php5-fpm.conf
sudo vim /etc/php5/fpm/pool.d/www.conf
This last step doesn't appear to be necessary.
sudo vim /etc/ssh/sshd_config
sudo reload ssh
Create an Apache configuration file: etc/apache2/conf.d/php5-fpm.conf
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
<Directory "/var/www/fastcgi">
Order allow,deny
<Files "php5.fastcgi">
Order deny,allow
</Files>
</Directory>
</IfModule>
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo vim /etc/apache2/mods-enabled/dir.conf
apt-cache search php5-
sudo apt-get install php5-cli php5-curl php5-gd php5-json php5-xmlrpc php5-xsl
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
cd /var/www/html/
sudo chown -R username:username /var/www
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | ssh [email protected] "cat >> ~/.ssh/authorized_keys"
sudo apt-get install build-essential libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
sudo apt-get install git
sudo service apache2 restart && sudo service php5-fpm restart
sudo apt-get install php5-dev
sudo apt-get install gcj-jdk
Find the instructions for installing Saxon/C on the Saxonica site.
cd ~/downloads
wget http://www.saxonica.com/saxon-c/libsaxon-HEC-setup64-v0.3.1.zip
unzip libsaxon-HEC-setup64-v0.3.1.zip
There are two files in the ZIP archive:
jet-1000-eval-en-linux-amd64-reg.bin
libsaxon-HEC-setup64-v0.3.1
Run the install script:
./libsaxon-HEC-setup64-v0.3.1
Which should list the files installed in the selected installation directory, then return:
Saxon-HEC 0.3.1 has been successfully installed on your computer.
Change directories into the Saxon-C-API
directory:
cd Saxonica/Saxon-HEC0.3.1/Saxon-C-API/
Run the phpize
command, which should return:
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Then run the ./configure --enable-saxon
command.
If the configuration runs without errors, then copy the libraries supplied with Saxon HE/C download:
cd /usr/lib
cp -r ~/downloads/Saxonica/Saxon-HEC0.3.1/rt .
export LD_LIBRARY_PATH=/usr/lib/rt/lib/amd64:$LD_LIBRARY_PATH
Edit the Apache environment configuration file:
sudo vim /etc/apache2/envvars
And add the following to the end of the file:
export LD_LIBRARY_PATH=/usr/lib/rt/lib/amd64:$LD_LIBRARY_PATH
Then, run the make
command. If all goes well, you should see the following:
----------------------------------------------------------------------
Libraries have been installed in:
/home/stephen/downloads/Saxonica/Saxon-HEC0.3.1/Saxon-C-API/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
To finish the Saxon install, run the following:
sudo make install
This should return the success message:
Installing shared extensions: /usr/lib/php5/20121212/
Create the saxon.ini
file:
sudo vim /etc/php5/apache2/conf.d/saxon.ini
The file should contain the following:
extension=saxon.so
The extension will be dynamically loaded when Apache is restarted:
sudo service apache2 restart && sudo service php5-fpm restart
Navigate to the phpinfo file to verify that the Saxon extension has been successfully enabled.
Saxon/C | enabled |
---|---|
Saxon/C EXT version | 0.3.1 |
Saxon-HEJ | 9.5.1.5 |
Excelsior JET (MP2) | 9.0 |
You also should put
Saxonica/Saxon-HEC0.3.1/libsaxon.so
to/usr/lib
beforemake