Can not run my php script

10 posts / 0 new
Last post
#1 Fri, 10/23/2009 - 14:40
Anonymous

Can not run my php script

I am having problems running php scripts that use the DOMDocument class.

e.g. $dom = new DOMDocument(); $doc->loadHTMLFile($page); echo $doc->saveHTML();

I get this error. Fatal error: Class 'DOMDocument' not found

When I looked up the class on the php manual it says this: There is no installation needed to use these functions; they are part of the PHP core.

I googled the problem at found this: Fedora 4 doesn't come with the php-xml rpm installed.

My system info says: Kernel and CPU Linux 2.6.18-53.1.14.el5 on i686

Does this not have the php-xml rpm installed.?

How do I get this running ? - I am not up to speed with this kind of change .

Fri, 10/23/2009 - 14:51
andreychek

Howdy,

I am not up to speed with this kind of change .

If you're still using Fedora Core 4, it sounds as if you may not be up to speed with a lot of changes :-)

Make sure you're finding a way to get the security updates in place, as FC4 hasn't any updates made for it since 2006 or so.

Anyhow, onto your question --

If you're getting that error, it does sound like php-xml either isn't installed, or isn't being loaded.

You may want to log into your system using SSH, and type:

rpm -qa | grep php

To see what PHP modules are installed. If you don't see the ones you need, you'll just need to go ahead and install it using "yum".

-Eric

Fri, 10/23/2009 - 23:57
Davvit

Thanks for your help.

I ran the command and got this reply:

php-mcrypt-5.1.6-15.el5.centos.1

wbm-php-pear-1.5-1

php-pdo-5.1.6-23.el5

php-snmp-5.1.6-23.el5

php-devel-5.1.6-23.el5

php-gd-5.1.6-23.el5

php-pear-1.4.9-4

php-common-5.1.6-23.el5

php-cli-5.1.6-23.el5

php-mysql-5.1.6-23.el5

php-pgsql-5.1.6-23.el5

php-mbstring-5.1.6-23.el5

php-odbc-5.1.6-23.el5

php-imap-5.1.6-23.el5

php-5.1.6-23.el5

php-ldap-5.1.6-23.el5

php-xmlrpc-5.1.6-23.el5

The last one in the list looks like the one -

so that means that it should be running ?

Is there something it the php.ini file that I need to turn on ?

Sat, 10/24/2009 - 00:05
andreychek

Well, I'm not entirely certain what distro you're running there (those package names suggest CentOS 5) -- but I suspect you'd want php-xml rather than what you already have installed, which is php-xmlrpc.

If your distro has the php-xml package, you'd just need to install it with: yum install php-xml

Sat, 10/24/2009 - 03:25
Davvit

OK I ran that from command shell and it didn't work So I ran it fom putty and I got:

Installed: php-xml.i386 0:5.1.6-23.2.el5_3 Dependency Updated: php.i386 0:5.1.6-23.2.el5_3 php-cli.i386 0:5.1.6-23.2.el5_3 php-common.i386 0:5.1.6-23.2.el5_3 php-devel.i386 0:5.1.6-23.2.el5_3 php-gd.i386 0:5.1.6-23.2.el5_3 php-imap.i386 0:5.1.6-23.2.el5_3 php-ldap.i386 0:5.1.6-23.2.el5_3 php-mbstring.i386 0:5.1.6-23.2.el5_3 php-mysql.i386 0:5.1.6-23.2.el5_3 php-odbc.i386 0:5.1.6-23.2.el5_3 php-pdo.i386 0:5.1.6-23.2.el5_3 php-pgsql.i386 0:5.1.6-23.2.el5_3 php-snmp.i386 0:5.1.6-23.2.el5_3 php-xmlrpc.i386 0:5.1.6-23.2.el5_3 Complete!

Then I ran this again [root@heavyhoster ~]# rpm -qa|grep php

and get: php-mcrypt-5.1.6-15.el5.centos.1 wbm-php-pear-1.5-1 php-common-5.1.6-23.2.el5_3 php-imap-5.1.6-23.2.el5_3 php-mbstring-5.1.6-23.2.el5_3 php-xml-5.1.6-23.2.el5_3 php-pear-1.4.9-4 php-pdo-5.1.6-23.2.el5_3 php-5.1.6-23.2.el5_3 php-pgsql-5.1.6-23.2.el5_3 php-devel-5.1.6-23.2.el5_3 php-odbc-5.1.6-23.2.el5_3 php-gd-5.1.6-23.2.el5_3 php-mysql-5.1.6-23.2.el5_3 php-cli-5.1.6-23.2.el5_3 php-ldap-5.1.6-23.2.el5_3 php-xmlrpc-5.1.6-23.2.el5_3 php-snmp-5.1.6-23.2.el5_3

So hopefully it will be ok.

I will just go and check.

Sat, 10/24/2009 - 03:29
Davvit

OH dear :(

I still get :

Fatal error: Class 'DOMDocument' not found

Do I need to restart the web server or the mysql server ?

Sat, 10/24/2009 - 04:01
Davvit

OK - I did RESTARTED both servers and the error changed to:

Warning: DOMDocument::loadHTMLFile() [function.DOMDocument-loadHTMLFile]: I/O warning : failed to load external entity " <meta name="keywords" content="site seal, trust seal, website seal, business seal, customer feedback software, approval, validate, e-commerce, feedback, visitor feedback, validation, customer support software, consumer care, ecommerce, in /home/tolly/public_html/curl_5.php on line 33

looks like its a script error so propbably the restart did the trick

Thanks for helping. :)

Sat, 10/24/2009 - 04:33
Davvit

That funny these two sites are now not working:

http://www.support-focus.com/customer-service-software.html

http://www.expert-world.com/website-traffic.htm

Is it related to the changes I just did ?

Sat, 10/24/2009 - 04:34
Davvit

No it is OK now,

I think it was just a coincidence !

Sat, 10/24/2009 - 08:02
andreychek

Glad to hear it's working now, thanks for the update!

-Eric

Topic locked