Project

Profile

Help

Support #2175

closed

A problem with pre-compiled php_saxon.dll in WAMP environment

Added by Dmitry Kruglov over 9 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
PHP API
Start date:
2014-10-10
Due date:
% Done:

0%

Estimated time:
Found in version:
0.3.1
Platforms:

Description

Hi

I downloaded and installed Saxon-HEC http://www.saxonica.com/saxon-c/libsaxon-HEC-setup-v0.3.1.exe for Windows and used pre-compiled php_saxon.dll for PHP 5.4.x

I have freshly installed x86 WAMP 2.4 with PHP 5.4.33

This is my test code:

<?php
$xml = 'trax\xml\foo.xml';
$xsl = 'trax\xsl\foo.xsl';
if(file_exists($xml)) echo "XML file {$xml} is OK; ";
if(file_exists($xml)) echo "XSL file {$xsl} is OK; ";
@$proc = new SaxonProcessor();
$proc->setSourceFile($xml);
$proc->setStylesheetFile($xsl);
$result = $proc->transformToString();                          
var_dump($result);

This is my output:

XML file trax\xml\foo.xml is OK; XSL file trax\xsl\foo.xsl is OK; 
( ! ) Warning: C:\wamp\bin\apache\Apache2.4.4 in C:\wamp\www\sax\test.php on line 6
object(SaxonProcessor)[1]
null

First, instantiation of SaxonProcessor class always throws a weird Warning message, however the object is created.

Apache log:

[Fri Oct 10 16:59:30.703287 2014] [:error] [pid 7472:tid 1532] [client 127.0.0.1:53302] PHP Warning:  C:\\wamp\\bin\\apache\\Apache2.4.4 in C:\\wamp\\www\\sax\\test.php on line 6
[Fri Oct 10 16:59:30.703287 2014] [:error] [pid 7472:tid 1532] [client 127.0.0.1:53302] PHP Stack trace:
[Fri Oct 10 16:59:30.703287 2014] [:error] [pid 7472:tid 1532] [client 127.0.0.1:53302] PHP   1. {main}() C:\\wamp\\www\\sax\\test.php:0
[Fri Oct 10 16:59:30.703287 2014] [:error] [pid 7472:tid 1532] [client 127.0.0.1:53302] PHP   2. SaxonProcessor->__construct() C:\\wamp\\www\\sax\\test.php:6

Second, it always prepends working directory of Apache (not the webroot) to the files' path which makes it hard to feed source files to the methods. Also, it makes it impossible to set files on a different drive. This is what happens when just a relative path to xsl file is given:

Error 
  I/O error reported by XML parser processing
  C:\wamp\bin\apache\Apache2.4.4/trax\xsl\foo.xsl: The system cannot find the path specified
Exception in thread "main" net.sf.saxon.s9api.SaxonApiException: Failed to compile stylesheet. 1 error detected.
	at net.sf.saxon.option.cpp.XsltProcessorForCpp.xsltApplyStylesheet(Unknown Source)
Caused by: net.sf.saxon.trans.XPathException: Failed to compile stylesheet. 1 error detected.
	... 1 more

Please register to edit this issue

Also available in: Atom PDF