I'm getting this error whenever cron.php page is accessed

Fatal error: Call to undefined function: xml_parser_create() in /var/www/hypersensory.com/htdocs/includes/xmlrpc.inc on line 131

It looks like i'm having problems with php and xml, but can't figure out what exactly.

Comments

Tomi’s picture

It seems to me that you don't have the XML extension of PHP properly installed.
http://www.php.net/manual/en/ref.xml.php

Johnyp’s picture

PHP has xml enabled and was compiled with it. All other xml related stuff seems to work just fine.

Because of this issue, cron.php will not run...!

styro’s picture

xml_parser_create() is part of the XML PHP module. If the function is undefined then it would probably be a problem with the way your XML module is installed. Drupal doesn't really have any way of hiding PHP modules as far as I'm aware.

Can you use the xml_parser_create() function in a plain old non Drupal php file?

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

Johnyp’s picture

Hi Anton,
I would love to check if i can use this function on the old drupal files, however, i'm do not know how to do that. I'm not a developer, and my knowledge of web technologies is very limited.

I'm using standard,stable, official packages of Apache2,MySQL, php4 on Gentoo linux. So i don't see how it could be an issue with module install, since it's done automateically during the install of php (no errors during or post install).

The strange part is that i have another Drupal 4.7.2 site on the same gentoo server, and it has no problems running cron.php. Which means that php/xml install is actually "OK".

Both sites are Drupal 4.7.2 and of course on the same versions on Apache2,php/xml,mysql.

styro’s picture

in the output of phpinfo() between the two servers. Look at the "configure command" section at the top, and the xml section near the bottom.

For instance on Debian the relevant bits in the configure command are:

'--disable-xml' '--with-expat-dir=/usr'

Which means. that it won't use the built in PHP expat compatible parser (--disable-xml), but to use the system supplied expat parser instead (--with-expat-dir=/usr).

This is mentioned in the installation and requirements section of this page:
http://www.php.net/manual/en/ref.xml.php

And on Debian, the xml section of phpinfo() is:

XML Support               active
XML Namespace Support     active
EXPAT Version             expat_1.95.8

I only have a little bit of experience with Gentoo, but do both servers have identical USE flags?

I would expect configuration issues like this to be much more prevalent on a distro like Gentoo than binary distros. PHP modules are generally a compilation time configuration option, and when you are compiling your own packages you have more scope to build things differently.

As for testing xml_parser_create() in a PHP file, just try something like this:

<?php
  $xml_parser = xml_parser_create("");
  print $xml_parser;
?>

If that still gives an error about undefined function, then it is definately your server config that needs fixing. If it works you will probably get something about a resource id printed out.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

Johnyp’s picture

Ok, perhaps i didn't explain it correctly:

both drupal websites are located on the same server. I have one single Gentoo box that runs two sites. One of them has this problem, the other one doesn't.

I've just created the test file with the php code you posted above and tried to access it via the web - here is the output in the browser
Fatal error: Call to undefined function: xml_parser_create() in /var/www/hypersensory.com/htdocs/test.php on line 2

In the use flags for php i have enabled xml support (all the features/modules with a plus sign have been installed, while those with minus have not been installed).

[ebuild R ] dev-lang/php-4.4.2 -adabas -apache +apache2 -bcmath -berkdb -birdstep -bzip2 -calendar -cdb +cgi -cjk +cli -crypt +ctype -curl -db2 -dbase -dbmaker -dbx -debug -discard-path -doc -empress -empress-bcs -esoob +exif -expat +fastbuild -fdftk -filepro -firebird -flatfile +force-cgi-redirect -frontbase +ftp +gd -gd-external -gdbm -gmp -hardenedphp -hyperwave-api -iconv -imap -informix -inifile -interbase -iodbc -ipv6 -java-external -java-internal -kerberos -ldap -libedit -mcal -mcve -memlimit -mhash -ming -mnogosearch -msql -mssql +mysql -ncurses +nls -oci8 -oci8-instant-client -odbc -oracle7 -overload -ovrimos -pcntl +pcre -pfpro -pic -posix -postgres -readline -recode -sapdb +session -sharedext -sharedmem -snmp +sockets -solid -spell -sqlite -ssl -sybase -sybase-ct -sysvipc -threads -tokenizer +truetype +unicode -wddx <b>+xml +xmlrpc</b> -xpm +xsl -yaz -zip +zlib

As you can see expat is not enabled, but as far as i understand i don't need it.

styro’s picture

Does the other site give the same error with that PHP file?

did you look at your phpinfo()?

Are there any Apache configuration differences between the two sites?

What exactly does the XML stuff on the other site do?

Really there is nothing much Drupal can do to affect this stuff (and the stand alone file not working confirms that), you really need to ask the Gentoo and/or PHP people why that file won't work on one (or both?) of your sites.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

Johnyp’s picture

Anton, thank you very much for help.
I've found the problem. After i have recompiled PHP with XML support I didn't restart all the needed services which resulted in this problem. Now everything seems to work just fine.

Thank you once again.

JohnyP