I have the following PHP code where I am trying to transform an XML file.
Below is the PHP code:
$xmldoc = new DOMDocument();
$xmldoc->load('somefile.xml');
$xsldoc = new DOMDocument();
$xsldoc->load('somexsltfile.xslt');
$xslt = new XSLTProcessor();
$xslt->importStylesheet($xsldoc);
$result = $xslt->transformToDoc($xmldoc);
$result->save('somefile.xml');
While running this php file I am unable to load the xml file. Looks like I need to install libxml, libxslt library since I am using XSLTProcessor and DOMDocument. My build server is using PHP 5.3.10 version. In the php.ini file I see only following extensions loaded (built-in?) :
[PHP_GD2]
extension=php_gd2.dll
[PHP_OCI8]
extension=php_oci8.dll
[PHP_OCI8_11G]
extension=php_oci8_11g.dll
But when I run “php –m
” on CLI I get:
[PHP Modules]
bcmath
calendar
com_dotnet
Core
ctype
date
dom
ereg
filter
ftp
gd
hash
iconv
json
libxml
mcrypt
mhash
mysqlnd
oci8
odbc
pcre
PDO
Phar
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
So now does that mean these above listed extensions are available to me on my build server? If yes then how can I access them in my php code?
And if not how can I get them installed on my build machine?Which are the dll’s required for these functions used in my php code like DOMDocument and XSLTProcessor()
functions?
Please suggest.
Thanks in advance!
Updated: I installed the XSL extension and I now see extension=php_xsl.dll in my php.ini file
But what do i do for DOMDocument?
Also when I run phpinfo()
I see
DOM/XML => enabled, libXML support => active, XML Support => active,
XSL => enabled
libxslt Version => 1.1.23
So now how will I make use of these extensions which are enabled? Thanks