Project

Profile

Help

Bug #2222 » centos7setup.txt

Eirik Hanssen, 2015-11-25 09:10

 
# set up php5.5
# http://www.liquidweb.com/kb/how-to-install-apache-on-centos-7/
# https://www.linode.com/docs/websites/lamp/lamp-server-on-centos-7
# https://www.mojowill.com/geek/howto-install-php-5-4-5-5-or-5-6-on-centos-6-and-centos-7/

yum install httpd

# enable ports:
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
systemctl start httpd
systemctl enable httpd
systemctl status httpd
# systemctl stop httpd

yum install wget

# get php5.5 from remi repo
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm

# Enable remi repo and specifically php5.5 repo:
nano -cw /etc/yum.repos.d/remi.repo

# install php
yum install php php-gd php-mysql php-mcrypt php-mbstring

# Saxon C setup

cd /opt
wget http://www.saxonica.com/saxon-c/libsaxon-HEC-setup64-v0.3.1.zip
yum install zip unzip

unzip libsaxon-HEC-setup64-v0.3.1.zip
# run the Saxon/C installer and give the install path: /usr/lib/saxonica
./libsaxon-HEC-setup64-v0.3.1

# fix permissions

chown -R root /usr/lib/saxonica
chmod -R u+r /usr/lib/saxonica

# create symlinks
ln -s /usr/lib/saxonica/libsaxon.so /usr/lib/libsaxon.so
ln -s /usr/lib/saxonica/rt /usr/lib/rt

nano -cw /etc/ld.so.conf.d/jetvm.conf:
# add the following 3 lines:
#JetVM env path - required for Saxon
/usr/lib/saxonica/rt/lib/amd64
/usr/lib/Saxonica/rt/lib/amd64/jetvm

ldconfig

# Set apache envvars, on Centos7 this should be done in:
nano -cw /etc/sysconfig/httpd

# Append to the end of the file:
## Saxonica Saxon HEC support
LD_LIBRARY_PATH=/usr/lib/saxonica/rt/lib/amd64:/usr/lib/saxonica/rt/lib/amd64/jetvm:$LD_LIBRARY_PATH

# create a module configuration file:
nano -cw /etc/php.d/saxon.ini

# Add these two lines:
; configuration for php Saxon HEC module
extension=/usr/lib/saxonica/php_lib/saxon.so

# At this point the Saxon C module registers:
php -m | grep saxon -i
Saxon/C

# And also phpinfo() has a proper Saxon/C section.
# But trying to run Saxon/C in php fails:

php /var/www/html/saxon-c/index.php
FATAL ERROR: Unable to load /usr/lib/saxonica/rt/lib/amd64/libjava.so (libjvm.so: cannot open shared object file: No such file or directory)
JNI_CreateJavaVM() failed with result-1

# however, adding a symlink to libjvm.so as you have pointed out earlier fixes this problem:
ln -s /usr/lib/saxonica/rt/lib/amd64/jetvm/libjvm.so /usr/lib/libjvm.so

# trying php cli again:
php /var/www/html/saxon-c/index.php

# now the transformation works, the xslt transformation uses some xslt2 regex functions that work as intended

# Now running Saxon/C with commandline php works, but you still can't run Saxon/C with php through the apache web server:

# Trying to load the saxon-c page again (no output)

# Trying to troubleshoot:
[root@centos7 lib64]# systemctl status httpd -a | grep saxon

nov. 24 12:46:29 centos7.vm httpd[11166]: Unable to load /usr/lib/libsaxon.so
nov. 24 12:46:29 centos7.vm httpd[11166]: /usr/lib/libsaxon.so doesn't contain public JNI_GetDefaultJavaVMInitArgs

# have tried adding these symlinks, but it doesn't help:

ln -s /lib/libjvm.so /lib64/libjvm.so
ln -s /lib/libsaxon.so /lib64/libsaxon.so

# any suggestions?
(2-2/2)