Jump to content

xslt in php5


Recommended Posts

Hi I have installed PHP 5 from the non-safe-thread zip package from php.net/downloads.php which is working fine with my php files. However I need my php script to work with xml and xslt hence I need the xslt processor. I have read around this and basically everywhere says it is included in php 5 and that I just need to uncomment ;extension=php_xsl.dll which I have done...however when I restarted the server and ran my <?php phpinfo() ?> page XSLT was still not showing up although the XML libaries were. Could someone push me in the right direction here? thanks!

Link to comment
Share on other sites

  • 3 weeks later...

Are you sure you edited the correct php.ini file?

run phpinfo() and check what file is shown next to "Loaded configuration file"

That's the one you should change. If there is no configuration file found at that location, then the default settings are used.

Either copy the php.ini file you edited to that location or add the value :

PHPIniDir "path/to/php.ini"

to your httpd.conf file in Apache conf directory (assuming you are using Apache)

Link to comment
Share on other sites

Are any other non-standard extensions available when you un-comment them?

Are you running Windows?

Another possibility is that your extension_dir directive might be wrong.

If you have relative filenames for your extensions then you need to set the correct directory for the extensions such as:

extension_dir = c:/php/ext/

for example.

A further note: I had problems with this myself. The comments in the php.ini file says not to include the trailing slash. However I did include it and for some reason that worked. Try it both ways, with and without the slash.

 

Also if there are any syntax errors in the file, php uses default values

Another thing I noticed was that when I use c:/windows/php.ini then merely restarting the server doesn't always make the changes effective.

 

Let me know if it was solved.

Link to comment
Share on other sites

Hello again jamesm6162,

 

I think i am at lost here. i am a newbie too when it comes to configuration.

first yes, i am using windows. this is what shows in the phpinfo() -

 

PHP Version 5.3.0

 

Configuration File (php.ini) Path -C:\WINDOWS

Loaded Configuration File           -C:\wamp\bin\apache\Apache2.2.11\bin\php.ini

 

1. I have taken out the comments in the (C:\wamp\bin\apache\Apache2.2.11\bin\php.ini ). i am right in that? do i have to re-configure it to the directory as mentioned in number 2 below since that is the version i am using?

2. There is also a php.ini in (C:\wamp\bin\php\php5.3.0).

3. But i see all the ext. files in this directory (C:\wamp\bin\php\php5.3.0\ext).

4. And if there is a need to re-configure the httpd.conf file, which one then? i see one in (C:\wamp\bin\apache\Apache2.2.11\conf).

 

 

..and lastly, why do i read much in forums that one should seek the php.ini file in the C:/windows? i have sought it there, but i have none there. i apologize for the inconvenience, but this can mean much learning to me. be gracious.

 

thanks james and have a blessed day.

 

 

Link to comment
Share on other sites

By default any windows installation of PHP will look for php.ini in the c:\Windows directory, or in the directories specified by the PATH environment variable, or in Apache's working directory (/bin). However, if you specify PHPIniDir setting in your httpd.conf file (yes the one in the /conf directory of apache) then it will rather look there. It will still say the configuration path is C:\Windows, but the correct php.ini file is specified in "Loaded Configuration File", which in your case is "C:\wamp\bin\apache\Apache2.2.11\bin\php.ini "

 

But I see you are using WAMP, which already configured httpd.conf, and you can easily activate extensions by left clicking on the wamp icon in the taskbar then selecting:

PHP -> extensions

and then using the arrow at the bottom scroll down and click on XSL (almost at the bottom) wamp will automatically restart your server and you should see XSL in phpinfo().

 

The php.ini file in your PHP directory should be ignored it isn't used. If ever you want to open the correct php.ini file click on wamp icon in taskbar then

PHP -> php.ini

This will automatically open the one in C:\wamp\bin\apache\Apache2.2.11\bin\php.ini which is correct.

 

Also you shouldn't alter the extension_dir setting there because WAMP also did that for you.

Link to comment
Share on other sites

I have checked and did likewise. Through the wamp and the (php_xsl.dll) had been selected. However there is still no XSL support shown in the phpinfo().

 

I have read that lixml2 and libxslt libraries are essential too? I do not see them. Can it be the cause? May you recommend where i can download them and last but not least, provide me the details of how I should go about placing them as I ought.

 

Thanks a million james.

Link to comment
Share on other sites

libxml2 and libxslt are embedded in your php installation by default, so they shouldn't be the cause. I don't have these files on my computer either.

 

I am a bit stunned by this. I know it sounds silly, but are you sure your browser isn't caching the phpinfo page and redisplaying the same one that's in cache?

I can think of no other option but reinstalling wamp (first uninstall), and then activating the extensions using the GUI menu in the taskbar.

 

I really can't think of what else the problem can be without actually looking at it myself.

 

 

 

Link to comment
Share on other sites

Hi james, a few questions yet again.

 

I am practicing a consuming RSS feed tutorial. Before I un-commented the php.ini for the php_xsl.dll, the browser produced -

 

MM_XSLTransform error.

The server could not perform the XSL transformation because an XSLT processor for PHP could not be found. Contact your server administrator and ask them to install an XSLT processor for PHP.

 

So that is a definite answer.

 

But after I had un-commented php.ini for the xsl extension...this is what that had been shown in the browser -

 

Deprecated: Function set_magic_quotes_runtime() is deprecated in C:\wamp\www\mywebsite\includes\MM_XSLTransform\MM_XSLTransform.class.php on line 172.

 

But it still generates the RSS feed beneath it.

 

So I am asking you:

 

1. How do you check if your browser is caching the phpinfo() page and how do you undo that? (No what you suggested was not silly at all).

2. From what I mentioned above. Is it likely so that the XSL is already supported on the server?

 

thank you james

Link to comment
Share on other sites

Hi James, a

you are right in the sound silly question in regard to the "are you sure your browser isn't caching the phpinfo page." I cleared it.

 

detail generated from the phpinfo page -

xsl

XSL enabled

libxslt Version 1.1.23

libxslt compiled against libxml Version 2.6.32

EXSLT enabled

libexslt Version 0.8.13

 

uhm, if I am to ask of the "Deprecated: Function set_magic_quotes_runtime()" on my earlier post, am I at the right place?

 

All in all, thanks james. I have learned much even in the small time spent communicating with you.

Link to comment
Share on other sites

Hi

set_magic_quotes_runtime() is a function that sets the magic_quotes_runtime ini value for a single session (or request I think). The magic_quotes_runtime value is deprecated and won't be in PHP6 or later, so you shouldn't use it. This is however, just a warning so your code will still execute regardless. Best practice is not to use any deprecated features ever.

 

Check the PHP manual for these functions and settings, it's really quite helpful.

As for the browser caching, yes you can clear the cache, or mostly  just refreshing the page once or twice gets the new page version. Seems like your XSL was working after all.

 

Glad I could help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.