Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > Fatal error: Class 'DOMDocument' not found
User Name
Password
REGISTER NOW! Mark Forums Read

Add blocked Because of Adult Content

Reply
1 1st November 23:24
jeff_schwartz
External User
 
Posts: 1
Default Fatal error: Class 'DOMDocument' not found


I'm attempting to run the sample script on the PHP site:

<?php
$dom = new DOMDocument('1.0', 'iso-8859-1');
echo $dom->saveXML(); /* <?xml version="1.0" encoding="iso-8859-1"?> */
?>

but get the error:

Fatal error: Class 'DOMDocument' not found in /var/www/html/ajax/dom.php on line 2

I'm running ver. 5.1.6 and my config appears to be set up for xml:

'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif'
'--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'

Has anyone else run into this?

Thanks,

Jeff
  Reply With Quote


2 1st November 23:24
jochem
External User
 
Posts: 1
Default Fatal error: Class 'DOMDocument' not found


run into what? your configure line clearly states that the relevant extension is not compiled in (--disable-dom)

you want http://php.net/dom not http://php.net/xml
  Reply With Quote
3 1st November 23:24
kd
External User
 
Posts: 1
Default How to new a Object via class name String?


Hi , I'm a freshman in PHP, can anyone give me any advices?

I defied some simple classes, like "User", "Item"...

in a general way ,
$obj = new User();

specially, I need to assign a Object via a class name .

Now , my code :
switch ($className)
{
case "User":
return new User();
break ;
case "Item":
return new Item();
break ;
default:
break ;
}

I think that It's not a clever job. How to do it skillfully?

Thank you for any advice.
  Reply With Quote
4 1st November 23:24
robert
External User
 
Posts: 1
Default How to new a Object via class name String?


<?php

class User
{
}

class Item
{
}


function getObject( $name )
{
$obj = false;

if( class_exists( $name ) )
{
$obj = new $name();
}

return $obj;
}

var_dump( getObject( 'User' ) ); echo"\n\n";
var_dump( getObject( 'Item' ) ); echo"\n\n";
var_dump( getObject( 'Foo' ) ); echo"\n\n";
?>

Cheers,
Rob.
--
.................................................. ..........
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
.................................................. ..........
  Reply With Quote
Reply


Thread Tools
Display Modes




666