SimpleXML doesn’t Work with PHP 5.x: Problem & Solution
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!
Filed under Headline News, How To, PHP, Tech Note, Web, Web Services |
|
RSS 2.0 |
Trackback this Article
|
Email this Article
You may also like to read |





































November 22nd, 2005 at 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. [...]
November 22nd, 2005 at 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. [...]