Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOMDocument on a linux running centos

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
GB
Hi All,

Hoping that someone can help me out there. We have written some code to allow editing of an xml file, this code loads an xml doc using DOMDocument, we are then doing an xpath expression on it and some ther processing. this is working fine on my wamp install on my PC, but putting onto our staging server is failing with an error:

Fatal error: Class 'DOMDocument' not found

this is the code

Code:
$xml = new DOMDocument;
$xml->load('section_text.xml');
                                                 
$xpath = new DOMXpath($xml);
$nodelist = $xpath->query('//item[@id=3]');
$oldnode = $nodelist->item(0);

we are running php 5.2.x and accoring to the docs, domdocument is supported in 5>

anyone have any ideas?

Thanks

Tony
 
have you installed libxml? and are you sure that domDocument has been compiled in?

you probably need to do something like
Code:
yum install php5-domxml
 
apparetly the libxml is installed by default.

We've done a server restart and voila the dam thing is now working.

thanks for responding so soon though

Tony
 
in a normal installation the libs are installed by default. but when packages are installed via a package manager (such as yum, as is the case on centos), you need to install the sub-packages (like domxml) need to be installed manually via the same package installer.

when changes are made to php.ini (which often happens as a result of package installs), the web server needs to be restarted (when using sapi) to force a refreshed binding.

Code:
apache2 -k graceful
normally does the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top