Project

Profile

Help

Bug #2222 » centos7setup.txt

Eirik Hanssen, 2015-11-25 09:10

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

    
6
yum install httpd
7

    
8
# enable ports:
9
firewall-cmd --permanent --add-port=80/tcp
10
firewall-cmd --permanent --add-port=443/tcp
11
systemctl start httpd
12
systemctl enable httpd
13
systemctl status httpd
14
# systemctl stop httpd
15

    
16
yum install wget
17

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

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

    
26
# install php
27
yum install php php-gd php-mysql php-mcrypt php-mbstring
28

    
29
# Saxon C setup
30

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

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

    
39
# fix permissions
40

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

    
44
# create symlinks
45
ln -s /usr/lib/saxonica/libsaxon.so /usr/lib/libsaxon.so
46
ln -s /usr/lib/saxonica/rt /usr/lib/rt
47

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

    
54
ldconfig
55

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

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

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

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

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

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

    
77
php /var/www/html/saxon-c/index.php 
78
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)
79
JNI_CreateJavaVM() failed with result-1
80

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

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

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

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

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

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

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

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

    
101
ln -s /lib/libjvm.so /lib64/libjvm.so
102
ln -s /lib/libsaxon.so /lib64/libsaxon.so
103

    
104
# any suggestions?
(2-2/2)