Project

Profile

Help

How to connect?
Download (26.8 KB) Statistics
| Branch: | Tag: | Revision:

he / latest9.9 / hec / saxonc-doc / doc / starting.xml @ 1ff21c76

1
<?xml version="1.0" encoding="UTF-8"?>
2
<article id="starting" title="Getting Started">
3
   <h1>Getting Started</h1>
4

    
5
   <p>This section of the documentation describes how to get hold of Saxon/C and the PHP and Python
6
      extensions, how to install on the different platforms, and how to get started using it.</p>
7

    
8
   <nav>
9
      <ul/>
10
   </nav>
11

    
12
   <p>Please use the help forums ("Forums") and bug trackers ("Issues") in the <a target="_blank"
13
         href="https://saxonica.plan.io/projects/saxon-c">Saxon/C project</a> at the Saxonica
14
      community site if you need help or advice, or want to provide any other feedback.</p>
15

    
16

    
17
   <section id="installing" title="Installing Saxon/C">
18
      <h1>Installing Saxon/C</h1>
19

    
20
      <p>Saxon/C can be installed on Linux, Mac OS and Windows. In this section we provide a step by
21
         step installation guide for the three platforms.</p>
22

    
23
      <nav>
24
         <ul/>
25
      </nav>
26

    
27
      <p>For information on installing the PHP and Python extensions see the <a
28
            href="/starting/installingphp">PHP Extension</a> and <a
29
            href="/starting/installingpython">Python Extension</a> sections.</p>
30

    
31
      <section id="installingLinux" title="Linux">
32
         <h1>Installing on Linux</h1>
33

    
34
         <aside>In the following, [EDITION] means one of: HE, PE, EE; and [VERSION] is the
35
            maintenance release version number (for instance 1.2.1). </aside>
36
         
37
         <ol>
38
            <li>
39
               <p><b>Download</b></p>
40
               <p>Download the Saxon/C software from www.saxonica.com. There are different downloads
41
                  available for the Saxon-HE, Saxon-PE and Saxon-EE products, for different
42
                  operating systems.</p>
43
            </li>
44
            <li>
45
               <p><b>Unpack</b></p>
46
               <p>To install the Saxon-[EDITION]/C release on Linux, first unzip the file
47
                  <code>libsaxon-[EDITION]C-setup64-v[VERSION].zip</code> and execute the following
48
                  command to fully unpack the files:</p>
49
               <kbd>./libsaxon-[EDITION]C-setup64-v[VERSION]</kbd>
50
            </li>
51
            <li>
52
               <p><b>Copy the core Saxon/C installation files to the install location</b></p>
53
               <p>The core Saxon/C files which must be copied are:</p>
54
               <ul>
55
                  <li><code>libsaxon[EDITION].so</code> - Saxon/C library</li>
56
                  <li><code>rt</code> directory - Excelsior JET runtime which handles VM calls</li>
57
                  <li><code>saxon-data</code> directory</li>
58
               </ul>
59
               
60
               <p>On Linux, the expected install location is <code>/usr/lib</code>, and the following
61
                  commands use this default. If you choose to install to a different location, then
62
                  the SAXONC_HOME variable must be set accordingly (see the next step).</p>
63
               
64
               <p>For instance, to copy the product files from the unpacked location
65
                  <code>Saxonica/Saxon-[EDITION]C-[VERSION]</code>, to <code>/usr/lib</code>:</p>
66
               
67
               <kbd>cd Saxonica/Saxon-[EDITION]C-[VERSION]/</kbd>
68
               <kbd>sudo cp libsaxon[EDITION].so /usr/lib/.</kbd>
69
               <kbd>sudo cp -r rt /usr/lib/.</kbd>
70
               <kbd>sudo cp -r saxon-data /usr/lib/.</kbd>
71
            </li>
72
            <li>
73
               <p><b>Set the SAXONC_HOME environment variable</b></p>
74
               <p>The SAXONC_HOME variable must be set to the location where the Saxon/C files have
75
                  been installed. For instance:</p>
76
               <kbd>export SAXONC_HOME=/usr/lib</kbd>
77
               <p>If the Saxon/C files were installed to a location other than the default
78
                  <code>/usr/lib</code>, then the SAXONC_HOME variable must be set to the correct
79
                  location.</p>
80
            </li>
81
         </ol>
82
         
83
         <aside>The use of symbolic links to specify where the Saxon/C library is installed is no longer
84
            recommended. It is better to set the SAXONC_HOME environment variable directly.</aside>
85

    
86
         <p>Saxon/C is now installed, and ready to run. Please see <a href="../running">Running
87
               Saxon/C</a> to get started. Note that the commercial products Saxon-PE/C and
88
            Saxon-EE/C require a license, so you may also need to refer to <a href="../licensing"
89
               >Licensing</a> for details about how to get this set up.</p>
90

    
91
      </section>
92

    
93

    
94
      <section id="installingMac" title="Mac OS">
95
         <h1>Installing on Mac OS</h1>
96

    
97
         <aside>In the following, [EDITION] means one of: HE, PE, EE; and [VERSION] is the
98
            maintenance release version number (for instance 1.2.1). </aside>
99
         
100
         <ol>
101
            <li>
102
               <p><b>Download</b></p>
103
               <p>Download the Saxon/C software from www.saxonica.com. There are different downloads
104
                  available for the Saxon-HE, Saxon-PE and Saxon-EE products, for different
105
                  operating systems.</p>
106
            </li>
107
            <li>
108
               <p><b>Unpack</b></p>
109
               <p>To install the Saxon-[EDITION]/C release on Mac OS, first unpack the download by
110
                  unzipping the file <code>libsaxon-[EDITION]C-mac-setup-v[VERSION].zip</code>.</p>
111
            </li>
112
            <li>
113
               <p><b>Copy the core Saxon/C installation files to the install location</b></p>
114
               <p>The core Saxon/C files which must be copied are:</p>
115
               <ul>
116
                  <li><code>libsaxon[EDITION].dylib</code> - Saxon/C library</li>
117
                  <li><code>rt</code> directory - Excelsior JET runtime which handles VM calls</li>
118
                  <li><code>saxon-data</code> directory</li>
119
               </ul>
120
               
121
               <p>On Mac OS, the expected install location is <code>/usr/local/lib</code>, and the following
122
                  commands use this default. If you choose to install to a different location, then
123
                  the SAXONC_HOME variable must be set accordingly (see the next step).</p>
124
               
125
               <p>For instance, to copy the product files from the unpacked location
126
                  <code>Saxonica/Saxon-[EDITION]C-[VERSION]</code>, to <code>/usr/local/lib</code>:</p>
127
               
128
               <kbd>cd Saxonica/Saxon-[EDITION]C-[VERSION]/</kbd>
129
               <kbd>sudo cp libsaxon[EDITION].dylib /usr/local/lib/.</kbd>
130
               <kbd>sudo cp -r rt /usr/local/lib/.</kbd>
131
               <kbd>sudo cp -r saxon-data /usr/local/lib/.</kbd>
132
               
133
               <aside>If you encounter permission issues after copying, then the privileges of
134
                  the folders and files may need adjusting.</aside>
135
            </li>
136
            <li>
137
               <p><b>Set the SAXONC_HOME environment variable</b></p>
138
               <p>The SAXONC_HOME variable must be set to the location where the Saxon/C files have
139
                  been installed. For instance:</p>
140
               <kbd>export SAXONC_HOME=/usr/local/lib</kbd>
141
               <p>If the Saxon/C files were installed to a location other than the default
142
                  <code>/usr/local/lib</code>, then the SAXONC_HOME variable must be set to the correct
143
                  location.</p>
144
            </li>
145
         </ol>
146

    
147
         <p>Saxon/C is now installed, and ready to run. Please see <a href="../running">Running
148
               Saxon/C</a> to get started. Note that the commercial products Saxon-PE/C and
149
            Saxon-EE/C require a license, so you may also need to refer to <a href="../licensing"
150
               >Licensing</a> for details about how to get this set up.</p>
151

    
152
      </section>
153

    
154
      <section id="installingWindows" title="Windows">
155
         <h1>Installing on Windows</h1>
156

    
157
         <aside>In the following, [EDITION] means one of: HE, PE, EE; and [VERSION] is the
158
            maintenance release version number (for instance 1.2.1). </aside>
159
         
160
         <ol>
161
            <li>
162
               <p><b>Download</b></p>
163
               <p>Download the Saxon/C software from www.saxonica.com. There are different downloads
164
                  available for the Saxon-HE, Saxon-PE and Saxon-EE products, for different
165
                  operating systems.</p>
166
            </li>
167
            <li>
168
               <p><b>Unpack</b></p>
169
               <p>To install the Saxon-[EDITION]/C release on Windows, first run the executable
170
                  <code>libsaxon-[EDITION]-win-setup-v[VERSION].exe</code>.</p>
171
               <p>This installation script unpacks the Saxon/C files in the <code>C:\Program
172
                  Files\Saxonica\Saxon[EDITION][VERSION]</code> directory by default.</p>
173
            </li>
174
            <li>
175
               <p><b>Choose the install location for the core Saxon/C installation files</b></p>
176
               
177
               <p>On Windows, the default and recommended location is <code>C:\Program
178
                  Files\Saxonica\Saxon[EDITION][VERSION]</code>. This is the location that the
179
                  PHP extension looks for the Saxon/C DLL library, so we advise using this default
180
                  location.</p>
181
               
182
               <p>If you choose to install to a different location, then the SAXONC_HOME variable
183
                  must be set accordingly (see the next step).</p>
184
               
185
               <!--<p>TODO: how does the user specify the installation destination?</p>
186
               <p>Selected as a step in the installer executable???</p>-->
187
            </li>
188
            <li>
189
               <p><b>Set SAXONC_HOME environment variable</b></p>
190
               <p>If the Saxon/C files were installed to a location other than the default
191
                  <code>C:\Program Files\Saxonica\Saxon[EDITION][VERSION]</code>, then the
192
                  SAXONC_HOME variable must be set to the correct location.</p>
193
               <!--<p>TODO how?</p>-->
194
            </li>
195
         </ol>
196

    
197
         <p>Saxon/C is now installed, and ready to run. Please see <a href="../running">Running
198
               Saxon/C</a> to get started. Note that the commercial products Saxon-PE/C and
199
            Saxon-EE/C require a license, so you may also need to refer to <a href="../licensing"
200
               >Licensing</a> for details about how to get this set up.</p>
201

    
202

    
203
      </section>
204

    
205

    
206
   </section>
207

    
208
   <section id="licensing" title="Licensing">
209
      <h1>Licensing</h1>
210

    
211
      <h2 class="subtitle">Saxon-PE/C and Saxon-EE/C</h2>
212

    
213
      <p>Saxon-PE/C and Saxon-EE/C are commercial products, and require a license key. By
214
         downloading the software, you agree to the terms and conditions published at <a
215
            target="_blank" href="https://saxonica.com/license/eval-license.pdf"
216
            >https://saxonica.com/license/eval-license.pdf</a> (for use with a free <a
217
            target="_blank" href="https://saxonica.com/download/download.xml">evaluation
218
         license</a>) or <a target="_blank" href="https://saxonica.com/license/paid-license.pdf"
219
            >https://saxonica.com/license/paid-license.pdf</a> (in the case of paid-up licenses,
220
         purchased from our <a target="_blank" href="https://saxonica.com/shop/shop.html">online
221
            store</a>).</p>
222

    
223
      <h3>Location of the Saxon license file</h3>
224

    
225
      <p>Saxon/C looks in the path relative to where the main library has been installed. For
226
         example, in <code>/usr/lib</code> if this is where <code>libsaxon[EDITION]c.so</code> has
227
         been installed. Alternatively, Saxon also looks for the license according to the
228
         environment variable <code>SAXONC_HOME</code>, if this has been set.</p>
229
      <!--<p>The license file can also be placed in the same directory as the stylesheet, but we advise
230
         against this for PHP servers where the license might be compromised.</p>-->
231

    
232
      <p>Alternatively the <code>licenseFileLocation</code> configuration property can be used to
233
         provide the license location (see <a href="/configuration">Configuration</a> for more
234
         details about setting configuration features). For example, to provide the
235
            <code>licenseFileLocation</code> in PHP:</p>
236
      <samp><![CDATA[$saxonProc = new Saxon\SaxonProcessor(true);
237
$saxonProc->setConfigurationProperty("http://saxon.sf.net/feature/licenseFileLocation", "/usr/lib/saxon-license.lic");]]></samp>
238

    
239
      <h2 class="subtitle">Saxon-HE/C</h2>
240

    
241
      <p>Saxon-HE/C is an open-source product. The primary license is the <a target="_blank"
242
            href="https://www.mozilla.org/MPL/2.0/">Mozilla Public License version 2.0</a>. In most
243
         cases, the source files are marked as being "incompatible with secondary licenses", which
244
         means that the code cannot be combined with code issued under a GPL license (the reason for
245
         this is the difficulty of contacting all past contributors to gain their assent).</p>
246

    
247
      <p>Some components are licensed under the Apache version 2.0 license or under BSD-style
248
         licenses. For more information see the <a href="https://saxonica.com/license/license.xml"
249
            target="_blank">Licenses</a> section on the main Saxonica website.</p>
250

    
251
      <p>Although Saxon/C technically adheres to the definition of open source software, there are
252
         practical limitations. Specifically, the "Source Code Form" of the product, in the
253
         terminology of the MPL license, consists primarily of Java source code, and in order to
254
         build Saxon/C from the Java source code, you need access to the Excelsor JET development
255
         tools, which are no longer commercially available to new users.</p>
256

    
257

    
258
   </section>
259

    
260
   <section id="running" title="Running Saxon/C">
261
      <h1>Running Saxon/C</h1>
262

    
263
      <p>To check that Saxon/C is correctly installed (having followed the revelant instructions
264
         from <a href="../installing">Installing Saxon/C</a>, including getting the Saxon license
265
         location set up as required for Saxon-PE/C or Saxon-EE/C, as described in <a
266
            href="../licensing">Licensing</a>), you can try running some of the provided samples. </p>
267

    
268
      <p>For example, to run the C++ <code>testXPath</code> sample file on Linux or Mac OS use the
269
         following commands (where [PLATFORM] is linux or mac):</p>
270

    
271
      <kbd>cd samples/cppTests/</kbd>
272
      <kbd>./build64-[PLATFORM].sh</kbd>
273
      <kbd>./testXPath</kbd>
274

    
275
      <p>Similarly for Windows, use the commands:</p>
276

    
277
      <kbd>cd samples/cppTests/</kbd>
278
      <kbd>buildCPPSaxon[EDITION].bat</kbd>
279
      <kbd>testXPath.exe</kbd>
280

    
281
      <p>The <code>samples/cppTest</code> directory provides many more examples in C/C++ which can
282
         be run. For more information about these samples see <a href="/samples/samples_c"
283
            >Samples</a>.</p>
284

    
285

    
286
      <h2 class="subtitle">Using Saxon/C in applications</h2>
287

    
288
      <p>To get started please browse the <a href="/api">Saxon/C APIs</a>.
289
            <code>SaxonProcessor</code>, which acts as a factory class for generating the
290
         processors, is a good place to start.</p>
291

    
292
      <p>The <code>samples/cppTest</code> directory in the download provides example code in C/C++
293
         (and PHP and Python) which may also be helpful in learning how to use Saxon/C in your
294
         application. For further details see <a href="/samples/samples_c">Samples</a>.</p>
295

    
296
      <p>There are many parameters and options that can be set to control the way in which Saxon
297
         behaves. For more information about setting configuration features on
298
            <code>SaxonProcessor</code> and the other processors in Saxon/C, see <a
299
            href="/configuration">Configuration</a>.</p>
300

    
301
      <h2 class="subtitle">Command Line Interface</h2>
302

    
303
      <p>Saxon/C can be run from the command line in a similar way to its Java counterpart. See the
304
            <code>Transform.c</code> and <code>Query.c</code> files (and <code>Validate.c</code> for
305
         Saxon-EE/C) in the <code>command</code> directory. The <code>build.sh</code> script can be
306
         executed to build the command line programs.</p>
307

    
308
      <p>To run Saxon/C from the command line, the commands look like the following:</p>
309

    
310
      <kbd>./transform [options] [params]</kbd>
311
      <kbd>./query [options] [params]</kbd>
312
      <kbd>./validate [options] source.xml</kbd>
313

    
314
      <p>The same command line options as in the Java products are available in the Saxon/C command
315
         line tool. Please see the relevant sections of the Saxon 9.9 documentation for details:</p>
316

    
317
      <ul>
318
         <li>
319
            <a target="_blank"
320
               href="https://saxonica.com/documentation/index.html#!using-xsl/commandline">Running
321
               XSLT from the Command Line</a>
322
         </li>
323
         <li>
324
            <a target="_blank"
325
               href="https://saxonica.com/documentation/index.html#!using-xquery/commandline"
326
               >Running XQuery from the Command Line</a>
327
         </li>
328
         <li>
329
            <a target="_blank"
330
               href="https://saxonica.com/documentation/index.html#!schema-processing/commandline"
331
               >Running Validation from the Command Line</a>
332
         </li>
333
      </ul>
334

    
335

    
336

    
337
   </section>
338

    
339

    
340
   <section id="installingphp" title="PHP Extension">
341
      <h1>PHP Extension</h1>
342

    
343
      <p>The PHP extension is an interface module that allows Saxon/C to be invoked from PHP
344
         applications.</p>
345

    
346
      <h2 class="subtitle">Prerequisites</h2>
347

    
348
      <p>Please have the following packages on your machine to build Saxon/C for the PHP language:
349
            <code>make</code>, <code>php-devel</code>, (<code>php7.2-dev</code>),
350
            <code>apache2</code> or <code>httpd</code>, <code>gcc-c++</code> or <code>g++</code>,
351
            <code>gcj-jdk</code> (or just link the <code>jni.h</code> file in the
352
            <code>Saxon.C.API</code> directory).</p>
353

    
354
      <p>Saxon/C should already have been installed following the instructions at <a
355
            href="../installing">Installing Saxon/C</a>.</p>
356

    
357
      <h2 class="subtitle">Installing on Linux and Mac OS</h2>
358

    
359
      <!--<p>(Alternatively, you may like to use the installation script <a 
360
         href="https://saxonica.com/saxon-c/download/install.sh">install.sh</a> supplied by
361
         Petr Zak - written for a 64-bit machine, but can be changed for a 32-bit machine.)</p>-->
362

    
363
      <h3>Building with PHP7</h3>
364

    
365
      <p>The PHP extension is in the form of a C/C++ PHP7 extension to Saxon/C created using the
366
         Zend module API.</p>
367

    
368
      <p>To install, run the following commands:</p>
369

    
370
      <kbd>cd /usr/lib/Saxonica/Saxon-[EDITION]C[VERSION]/Saxon-C-API/</kbd>
371
      <kbd>phpize</kbd>
372
      <kbd>./configure --enable-saxon</kbd>
373
      <kbd>make</kbd>
374
      <kbd>sudo make install</kbd>
375

    
376
      <h3>Building with PHP5</h3>
377

    
378
      <p>The Saxon/C PHP extension is built for PHP7. To instead build with PHP5, first replace the
379
            <code>config.m4</code> file in the <code>Saxon-C-API/</code> directory with the one held
380
         in <code>Saxon-C-API/PHP5-Build</code>. Then run the installation steps above.</p>
381

    
382
      <p>Next create a module conf file: </p>
383

    
384
      <kbd>nano /etc/php/7.2/mods-available/20-saxon.ini</kbd>
385

    
386
      <p>with content:</p>
387

    
388
      <samp><![CDATA[; configuration for php Saxon HE/PE/EE module
389
         extension=saxon.so]]></samp>
390

    
391
      <p>and save the file. Now enable the module for PHP using the command:</p>
392

    
393
      <kbd>phpenmod saxon</kbd>
394

    
395
      <p>Alternatively, you can update the <code>php.ini</code> file or add the
396
            <code>20-saxon.ini</code> file under the <code>conf.d</code> directory (if using Ubuntu
397
         it is usually in the location <code>/etc/php/7.2/apache2/</code>) to contain the PHP
398
         extension. Insert the code <code>extension=saxon.so</code> in the Dynamic Extensions
399
         section, then run the following commands:</p>
400

    
401
      <kbd>sudo service apache2 restart</kbd>
402
      <kbd>php -m | grep saxon -i</kbd>
403

    
404
      <p>(Running these should display 'Saxon/C'.)</p>
405

    
406
      <p>If you cannot load the extension from the <code>php.ini</code> file, you need to load it at
407
         script execution time using the code: <code>dl(“saxon.so”);</code>. However this is not
408
         recommended as the loading and unloading can be slow.</p>
409

    
410
      <p>When working with PHP, the environment variables <code>LD_LIBRARY_PATH</code> and
411
            <code>SAXONC_HOME</code> should be added to the apache environment variables. The
412
         apache2 config file is located in one of the following locations depending on your linux
413
         distribution: </p>
414
      <ul>
415
         <li>Ubuntu server: <code>/etc/apache2/envvars</code></li>
416
         <li>Centos server: <code>/etc/sysconfig/httpd</code></li>
417
         <li>SUSE server: <code>/etc/sysconfig/apache2</code></li>
418
      </ul>
419

    
420
      <h2 class="subtitle">Installing on Windows</h2>
421

    
422
      <p>The PHP extension has not yet been built. It can be built using the PHP source. We hope to
423
         provide builds for PHP on Windows soon.</p>
424

    
425
      <p>On Windows we recommend setting the current working directory using the single-argument
426
         version of the <code>SaxonProcessor</code> constructor, because there remains an issue with
427
         building Saxon/C with PHP when using the function<code> VCWD_GETCWD</code>. That is,</p>
428

    
429
      <samp><![CDATA[$proc = new SaxonProcessor('C://www/html//trax//');]]></samp>
430

    
431
      <p>should replace instances of</p>
432

    
433
      <samp><![CDATA[$proc = new SaxonProcessor();]]></samp>
434

    
435
      <p>in your PHP scripts (see the <a href="/samples/samples_php">PHP Samples</a> for an
436
         example). </p>
437
   </section>
438

    
439
   <section id="installingpython" title="Python Extension">
440
      <h1>Python Extension</h1>
441

    
442
      <p>The Python extension is an interface module that allows Saxon/C to be invoked from Python
443
         applications.</p>
444

    
445
      <h2 class="subtitle">Prerequisites</h2>
446

    
447
      <p>Please have the following packages on your machine to build Saxon/C for the Python
448
         language: <code>Python3</code> (64-bit) and <code>Cython</code>.</p>
449

    
450
      <p>The Saxon/C Python extension API has been developed using Cython for Python3. Cython is
451
         required to build the extension library. To install Python and Cython on Mac OS, we
452
         recommend using brew or MacPorts.</p>
453

    
454
      <p>Saxon/C should already have been installed following the instructions at <a
455
            href="../installing">Installing Saxon/C</a>.</p>
456

    
457
      <h2 class="subtitle">Installing</h2>
458

    
459
      <p>The Python extension is held in the directory <code>Saxon.C.API/python-saxon</code>. </p>
460

    
461
      <h3>Linux and Mac OS Platforms</h3>
462
      <p>The Python extension on the Linux and Mac OS platforms can be built using the following
463
         command:</p>
464

    
465
      <kbd>python3 saxon-setup.py build_ext -if</kbd>
466

    
467
      <h3>Windows Platform</h3>
468

    
469
      <p>The Python extension on the Windows platform can be built using the following instructions:</p>
470
       <p>Install Python 3.X (64-bit) with VS 2017 or 2019 which can then be run
471
          with command "py" from Powershell.</p>
472

    
473

    
474
      <ul><li>For Python: update pip</li>
475
         <li>Use pip to install Cython: pip install Cython</li>
476
       <li>open Powershell for Python 3.X (with administrator rights if you
477
          installed in C:\Program Files)</li>
478
      </ul>
479
      <kbd>cd C:\Program Files\Saxonica\SaxonEDITIONX.X.X</kbd>
480
      <kbd>cd Saxon.C.API\python-saxon</kbd>
481
      <kbd>py saxon-setup.py build_ext -if</kbd>
482
       <p>For arbitrary Powershell Windows need to set: $Env:PYTHONPATH +=
483
       ";C:\Program Files\Saxonica\SaxonEDITIONX.X.X\Saxon.C.API\python-saxon" to
484
       ensure that "import saxonc" in any Python program finds the saxonc module</p>
485

    
486
   </section>
487

    
488
   <section id="troubleshooting" title="Troubleshooting">
489
      <h1>Troubleshooting</h1>
490

    
491
      <p>After installing Saxon/C, if you notice anomalies in execution, then the apache log file
492
         usually has useful information on errors reported and crashes. See below for a description
493
         of some of the common errors and crashes, and their solutions:</p>
494
      <ol>
495
         <li>
496
            <p>
497
               <code>FATAL ERROR: Unable to load /usr/lib64/rt/lib/amd64/libjava.so (libjvm.so
498
                  cannot open shared object file: No such file or directory) JNI_CreateJavaVM()
499
                  failed with result-1</code>
500
            </p>
501
            <p><b>Solution:</b> Running the following command should resolve the error:</p>
502
            <kbd>sudo ldconfig</kbd>
503
            <p>Ignore the message 'file /lib/libsaxon[EDITION].so is truncated'. The library was created using
504
            Excelsior JET.</p>
505
            <p>Alternatively create a symlink to the java virtual machine. This is not required to
506
               install or compile, but it is required for PHP code. The following command should
507
               resolve the issue on a 64-bit machine:</p>
508
            <kbd>ln -s $JAVA_HOME/jre/lib/amd64/server/libjvm.so /lib64/libjvm.so<br/></kbd>
509
            <p>Alternatively, it is possible to link the libjvm.so from the 'rt/lib/jetjvm'
510
               directory.</p>
511
         </li>
512
         <li>
513
            <p>
514
               <code>/usr/lib/Saxon-C-API/SaxonProcessor.h:3:17: fatal error: jni.h: No such file or
515
                  directory <br/>#include &lt;jni.h&gt; compilation terminated.</code>
516
            </p>
517
            <p><b>Solution:</b> Link the <code>jni.h</code> on the machine or simply install
518
                  <code>gcj-jdk</code> which should resolve this error. </p>
519
         </li>
520
         <li>
521
            <p>
522
               <code>PHP Warning: PHP Startup: Unable to load dynamic library
523
                  '/usr/lib/php/modules/saxon.so' - libsaxonhec.so: cannot enable executable stack
524
                  as shared object requires: Permission denied in Unknown on line 0</code>
525
            </p>
526
            <p>This has been observed on centos systems when SELinux is enforced/enabled.</p>
527
            <p><b>Solution:</b> Run the following command to show the security setting for the library files:</p>
528
            <kbd>ls -alZ /usr/lib" and 'ls -alZ /usr/lib/php/module/</kbd>
529
            <p>Then run the following commands or similar to change the security context:</p>
530
            <kbd>chcon system_u:object_r:lib_t:s0 /usr/lib/libsaxonhec.so</kbd>
531
            <kbd>chcon system_u:object_r:lib_t:s0 /usr/lib/php/modules/saxon.so</kbd>
532
         </li>
533
         <li>
534
            <p>Some 64-bit Linux flavors do not run the 32-bit JET libraries by default.</p>
535
            <p><b>Solution:</b> For instance, <code>ia32-libs</code> must be installed on
536
               Ubuntu/Debian, e.g. using the following command:<br/>
537
            </p>
538
            <kbd>sudo apt-get install ia32-libs</kbd>
539
         </li>
540
         <li>
541
            <p><code>Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll Error: : No error</code></p>
542
            <p>Caused by attempting to run Saxon/C in 32-bit environments, including 32-bit Python
543
               and PHP builds. Saxon/C can only run with 64-bit builds.</p>
544
            <p><b>Solution:</b> 
545
            The machine operating system must be 64-bit, and Python and PHP builds must be 64-bit to run with Saxon/C.</p>
546
         </li>
547
      </ol>
548

    
549

    
550
   </section>
551

    
552

    
553
</article>
(9-9/10)