It is actually quite simple to get it working, but not adequately documented on the PHP website. Get straightforward, bullet point instructions here (installs PHP as a module which is in fact faster than running it as CGI).
It is actually quite simple to get it working, but not adequately documented on the PHP website. Get straightforward, bullet point instructions here (installs PHP as a module which is in fact faster than running it as CGI).
- Get the latest PHP package from http://qa.php.net/ and unzip it. It will automatically create a folder named PHP_version. (P.S. Novice users may want to skip this entirely and download PHP, MYSQL etc bundled as
XAMPP from Apachefriends.org.) - Please follow the instructions in the README to install
Apache as a module (faster than running as CGI). This should include –- Copying the latest PHP files into your C:\PHP or wherever you have your PHP installed,
- Putting your PHP.INI file in the right place, mine is in C:\WINDOWS (you must have only one valid INI file),
- Copying the php4ts.dll file from your downloaded PHP_version folder into C:\WINDOWS\SYSTEM32
- Copy all the *.dll files from your downloaded
PHP_version\DLL folder into the C:\WINDOWS\SYSTEM32.
This will include the latest expat.dll and the
sablot.dll. - Copy the php_xslt.dll from your downloaded PHP_version\EXTENSIONS folder into the C:\WINDOWS\SYSTEM32.
- Now, open your PHP.INI and uncomment the
php_xslt.dll extension.-
# Remove the semi-colon ";" at the beginning
# of the line to uncomment the PHP_XSLT extension
OLD LINE –> ;extension=php_xslt.dll
NEW LINE –> extension=php_xslt.dll
-
- Just for reference, my HTTPD.CONF file for Apache
has the PHP module working as follows:-
# P.S. The LoadModule should be php4apache2.dll
if you use Apache 2
ScriptAlias /php/ “c:/php/”
LoadModule php4_module c:/php/sapi/php4apache.dll
AddType application/x-httpd-php .php
-
# P.S. The LoadModule should be php4apache2.dll
- Restart Apache, and hopefully time to say Bingo! If you have problems, please let
me know.
Testing your PHP XSLT installation:
Following is a zip file containing some examples for you to
test out your XSLT installation. Unzip it into your htdocs
folder, it will create a subfolder called xsltest.
Please read the README.TXT file inside this ZIP file for more.
Important notes to make sure XSLT works with PHP module of Apache:
- If running PHP as a module gives you problems, make sure you copy the
php4ts.dll file from your downloaded PHP_version
folder into C:\WINDOWS\SYSTEM32. This is
most often the cause of errors. - Make sure you don’t have many copies of the same DLLs lurking around
in various folders. This is often the problem. Specifically, for instance,
the same DLLs should not exist in C:\WINDOWS\SYSTEM and the C:\WINDOWS\SYSTEM32
folders. - If you are using really ancient versions of PHP (i.e., version less
than 4.1.xx) then this page
may be useful to you as well.
137 Comments
Has anyone generated DocBook Website output using this method?
Concerning placing dlls in your system32 folder.
I had a problem with apache not finding my modules while they were at the exact location as specified. Problem solved as I put php5ts.dll in the system32 folder. Turns out the other dlls need this one and it needs to be in the system path. I Suppose if you put the dir where php5ts.dll originally is in the path it will also work.
Hi thanks for giving the instruction on how to configure the xslt. I just have 1 problem, my php 4 is ok and working properly. But I also what to use xslt extension under php 5 but when I follow the same instruction it did not work on php 5 because the php_xslt.dll i have is i think design for php 4 only can u help me find php_xslt.dll for php 5.
thanks
Thanks you for the procedure to overcome my problem, but still i need some tips to generate a powerful index. because i use xslt and xml for this document.
If it still doesn’t work and you did what this tutorial says, try copying expat.dll, iconv.dll and sablot.dll to your system folder (c:\window\system32 on my pc).
I found these dlls in the ‘dlls’ folder of my php distribution.
When you begin desperately copying files into C:\WINDOWS\system32 .. and still not seeing any results try to begin with iconv.dll !
Normally you should NOT copy php4ts.dll, that should reside in the default php installation folder.
Hi. Getting a problem when trying to run Apache 1.3.. I got win 98 as an OS. The error message in the Prompt is like this:
[warn] No such file or directory: exec> may not be safe
Under that it says:
Apache/1.3.33 PHP/4.3.10 running…
It seems ok, but then when I try to make a simple PHP test and starting in the browser with ‘http://localhost/test.php’, then the WHOLE code shows up, NOT only the ‘echo’ in the PHP code, as it should be. so that is the problem for me.. you know what the problem could be?
how to enable sablotron XSLT on your TSW server
You don’t need to download anything. TSW has everything you need, it just needs a little tweaking
I copied essential files from the php folder to windows\system32
sablot.dll
expat.dll
php4ts.dll
php_xslt.dll
checked first if php was being loaded as a module on the apache.conf there should be an entry like this:
LoadModule php4_module
checked also on \\localhost\php.info to see if everything was allright. There you should see this line:
PHP Version 4.3.8
Configuration File (php.ini) Path C:/TSW/Apache2/conf/php.ini
———————————–
Now that you know where php.ini resides, go and remove this comments in it:
OLD LINE –> ;extension=php_xslt.dll
NEW LINE –> extension=php_xslt.dll
did the same for php_iconv.dll (though i don’t think its mandatory)
-Under PATHS AND DIRECTORIES, ADDED this path lines:
include_path = “.;C:\TSW\Apache2\php\”
include_path = “.;C:\WINDOWS\system32\”
Though i dont think it was necessary (heck! I dont even know if its really necessary to copy the .dll files to sys32!!).
Its working now, and thats what matters… for now
———————————————–
Then finally my last and decisive step was editing php_handler.conf located in C:\TSW\Apache2\conf\mods, uncommenting the following:
PHPINIDir conf/php.ini
LoadFile dll/sablot.dll
LoadFile dll/libintl-1.dll
LoadFile dll/gds32.dll
LoadFile dll/libmhash.dll
LoadFile php/pdflib.dll
AddType application/x-httpd-php .php .php3 .info
AddType application/x-httpd-php-source .phps
——
In the end your php.ini output should have this extra fields:
xml
XML Support active
XML Namespace Support active
EXPAT Version 1.95.6
xslt
XSLT support enabled
Backend Sablotron
Sablotron Version 1.0
Ready to rock!?? I am…
Thank You!
This article is very helpfull.
my question is if it is posible to run xslt on XAMPP and how to do that?
Thank You.
thank you.
it helped me a lot!
cheers
I was just wondering, as I’m new to XSLT, can a person use it without an xsl stylesheet? – I have an existing stylesheet I’d like to use – a css, is there either a way to refference that instead, or to convert my css to xsl?
Syntax error on line 519 of C:/Program Files/Apache Group/Apache2/conf/httpd
f:
Cannot load C:/PHP/sapi/php4apache.dll into server: The specified module cou
ot be found.
Note the errors or messages above, and press the key to exit. 17…
I’ve neen trying to do everything according to
the instructions above->Windows xp, Apache2,
php 4.3.10.But XSLT had not been added to the php info page and the code for running a test didn’t work.
Also according to some instructions in the php
homepage I’ve moved php.ini to the php folder
(c:/php/) and changed the extension_dir to
c:/php/extensions/ (removing the dll’s from the SYSTEM32 folder)
and moved the’;’ from extension=php_xslt.dll
things are not working !
Any suggestion ?
Hello,
I does, every step, but I have the following error when start the apache server: Unable to load dynamic library ‘./php_sxl.dll”
Regards
Hi there
I have configured PHP Version 5.0.4 on windows. Everything seems to work fine except
$xh = xslt_create();
Fatal error: Call to undefined function xslt_create().
In your tutorial you have suggested
“open your PHP.INI and uncomment the php_xslt.dll extension”
But i dont have any such line, instead i have php_xsl.dll, which i uncommented but no success.
Kindly suggest for this new verion of PHP.
Regards
JP, SimpleXML is builtin and has (my opinion) easier implementation. Example below.
— XML FILE: test.xml —
<?xml version=”1.0″?>
<human>
<person>
<firstname>Henry</firstname>
<lastname>Connor</lastname>
<email>hencor@youknow.com</email>
</person>
— PHP CODE —
<?php>
$human = simplexml_load_file(‘./test.xml’);
foreach($human->person as $person) {
echo ‘Firstname:’.$person->firstname;
echo ‘Lastname:’.$person->lastname;
echo ‘Email:’.$person->email;
}
?>
The rest is up to your imagination, hope this helps some.
Jkue, thanks for the contribution, I believe your code was caught up in our correction facility. Please mail me the code at shanx at sniptools dot com and I’ll put it up here. Cheers!
Was sent today Shanx.
hello,
When I am writting in httpd.conf the load module and restart apache2 server it appears a warning
can not load c:/php/sapi/php4apache2.dll to the server
regards
i m using php 5 . there is no xslt.dll written in php.ini. and your code error is
Fatal error: Call to undefined function xslt_create() in c:\webs\test\xsltest\complex.php on line 8
reply me plz
There is no XSLT Support in PHP5, you have to use DOM instead, or downgrade to PHP4
Hi Pablo, that’s not entirely accurate. PHP5 does have XSLT support although that’s been moved to PECL. There’s more info here: http://www.php.net/manual/en/ref.xslt.php
Quote:
Note: This extension has been moved to the PECL repository and is no longer bundled with PHP as of PHP 5.0.0. If you need xslt support with PHP 5 you can use the XSL extension.
That said, I agree with your general idea, using DomDocument is a lot faster on most systems.
I’ve installed Apache2, PHP and MySQL under WinXP. I’m running an XSLT transformation from a small PHP file and PHP won’t resolve the urls of the files involved correctly. I put “xml_file.xml” and “xsl_file.xsl” in the script for XSLT to work with, and the script tries to resolve the file URLs as c:\PHP\xml_file.xml, etc. even though the html pages correctly resolve partial urls to the htdocs dir under Apache. I think this is the problem with the XSL transformation coming up with the generic “invalid token”. Am I missing something in the PHP.ini that’s causing the error in resolving the urls? Any ideas would be very helpful!
Forget what I just posted. After downloading your sample files and finding that they worked just fine. My problem was the xslt_set_base command (I didn’t have one). Once I tore apart your file, I see that the file:// url had to be used instead of pointing at my server http:// url.
hi, thanks a lot, after 2 days of searching this was the only ! working method
every thing works fine.except tht when i run my apache4 ..,it says unable to load the module.the exact error is….
cannot load c:/php/php4apache2.dllinto server…the specified module could not be found
Anu, I guess you meant PHP4, not Apache4. That’s the most common error people see when they have not followed install instructions that come with PHP.
from http://qa.php.net/ and unzip
doesn’t seem to have any versions for windows -
I’ve found many versions of how to get xslt to work with windows – all slightly different but
doesn’t seem to work with PHP 5+
using sablot expat and placing the appropriate .dll files in the right places, making config changes see straight forward but all the doc i reads slightly contradicts and seems to be a year or 2 old.
I’m using PHP Version 4.4.2 with IIS using ISAPI.
I got it all working in my windows xp machine but i copy it to my w2003 machine(s) , the xslt wont appear at all in the phpinfo!!!
xslt:
XSLT support enabled
Backend Sablotron
Sablotron Version 1.0
Also for some reason the Configuration File (php.ini) Path is C:\WINDOWS\php.ini inststead of C:\WINDOWS\system32\php.ini as it was in xp ?!?!
It’s reading the ini (now i put it c:\windows instead) because i’ve changed the highlight.bg as a test.. whenever i change it in the ini and restart iis this updates but the xslt just wont include.. im not sure why as all the settings are the same. [this was after failing to get it to work in either with php5 so scrapping that all and going back to 4 beause the app my client uses needs it] with that darned “Fatal error: Call to undefined function: xslt_create()” which i only worked out was an incompatibility issue with php 5 prob by coming here.. so cheers for getting me this far!!!
I’ve even tried having the copying the php4ts.dll in sys32 and windows to hedge my bets to no avail.
i am getting internal server error and when i start apache console the i get 2 screens one which is empty and gets closed very rapidly and another with following lines
[Sat Mar 04 22:46:19 2006] [warn] (2)No such file or directory: exec() may not be safe
Apache/1.3.31 (Win32) running…
Hello, I’m a developer with a managed server so I don’t know much about servers. We have a trade show coming up and need to run our site off of a laptop and your tutorial on setting up xslt/sablotron for windows saved me. Thanks,
Ryan
Yes , your page has proved to me a little helpfull.
as i am using Apache/2.0.59 (Win32) PHP/5.1.6 , and there is no php_xslt.dll file in the ext folder of php but i found on php site file named php_xsl.dll will be used for xslt purpose so i tried whatever you said using this file. while using phpinfo(); method it shows the xsl support but when i browse your sample pages they donot show any thing except fatal error of xslt_create() not found at line at.
please help me out as i am struggling to do my final year project and time is running out.
also please note my php folder is c:\php and for apache is c:\Apache2
Hello,
I have a problem, I can’t configure my PHP 4.4 under Apache 2.2 with exsl suport. Can you help me?
In phe.ini I have xsl, domxml support, but no exsl support.
Thank you
Hi, I’m trying to use XSL on PHP5, but when I executed phpinfo() it don’t show me that I have installed the extension XSL, I already tried with this too “–with-xsl[=C:\wamp\php\ext]” in the PHP.INI but it don’t work, Any Idea? Sorry for the troubles and Thank you for your support.
I am just posting what my fix to this mess was. I am using XP SP2, apache 2, and php > 4.2.
I was unable to get phpinfo() to show any proof that the xslt extension was working. I noticed that the php.ini location at the top just said C:\Windows\ and nothing else. So, I looked in my apache config and noticed that my PHPIniDir was pointing to /php, so to fix it, I changed it to C:/apache/php/php.ini And, like magic, it worked.
Hi i am using php 5 and apache 2.2x getting error
“can’t locate API module structure ‘php_module’ in file “c:/php/php5apache2_2_dll: No error
Please help me out or send me how to configure it?