SimpleXML doesn’t Work with PHP 5.x: Problem & Solution
By Angsuman Chakraborty, Gaea News NetworkWednesday, November 16, 2005
SimpleXML is PHP 5.x way to handle XML. It is simpler than DOMXML (which incidentally is very poorly documented in manual or elsewhere) which is available on PHP 4.x and much simpler than SAX solutions. However it doesn’t work with certain installations of PHP 5.x. Let’s see how we can solve it.
Problem
I first came across this when I realized my code works in home machine and not on site. PHP as usual silently gives up (solution to this in next post). In essence simplexml_load_string returns false without actually creating and returning the object. So you cannot use SimpleXML in any way.
Solution
After some debugging I found the solution. Here are the steps:
1. Open php.ini (How to find it?)
2. Search for zend.ze1_compatibility_mode
3. Change it to Off as shown below
zend.ze1_compatibility_mode = Off
4. Save php.ini and restart Apache
You are done!
November 22, 2005: 11:57 am
[...] Reports Sony DRM Rootkit violating several open source licenses, lists Christmas wish from Google AdSense, provides tips on Google Analytics and simplifies SimpleXML for PHP developers. [...] |
November 22, 2005: 8:03 am
[...] Reports Sony DRM Rootkit violating several open source licenses, lists Christmas wish from Google AdSense, provides tips on Google Analytics and simplifies SimpleXML for PHP developers. [...] |
Best of The Fortnight Ending 20th November 2005 - Simple Thoughts - Java and Web Software