In what situation would the native php function error_reporting() not be available?

I am getting very intermittent errors in my web logs like this :

PHP Fatal error: Call to undefined function error_reporting() in /home/xxxx/domains/dr.xxxx.com/public_html/wp-load.php on line 23, referer: http://dr.xxxx.com/

This happens on all domains on the server. I realise it is probably a misconfiguration of the server itself and this may not be the best place to seek help but maybe someone else has experienced the same problem and resolved it?

Any help appreciated.

    It's a core function in both PHP 4 and 5 (as per the manual), so I would first ask which exact version of PHP are you using?

    Assuming you aren't using something archaic like PHP 3, I can really only think of two reasons why you would see that function undefined:

    1. A bug in PHP (it happens)

    2. The sysadmin compiled PHP from source after carefully modifying it to remove the function

    Any chance you could take a screenshot (or copy/paste, or provide a URL) of a [man]phpinfo/man readout? More specifically, can you show us at least the first table of values (e.g. the one that contains System, Build Date, etc.)?

      System	Linux mlwd901.xxxxxxxxx.net 2.6.23.17-88.fc7 #1 SMP Thu May 15 00:35:10 EDT 2008 i686
      Build Date	May 8 2008 08:39:32
      Configure Command	 './configure' '--build=i386-redhat-linux-gnu' '--host=i386-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' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--disable-json'
      Server API	Apache 2.0 Handler
      Virtual Directory Support	disabled
      Configuration File (php.ini) Path	/etc
      Loaded Configuration File	/etc/php.ini
      Scan this dir for additional .ini files	/etc/php.d
      additional .ini files parsed	/etc/php.d/dbase.ini, /etc/php.d/dom.ini, /etc/php.d/eaccelerator.ini, /etc/php.d/gd.ini, /etc/php.d/imap.ini, /etc/php.d/json.ini, /etc/php.d/ldap.ini, /etc/php.d/mbstring.ini, /etc/php.d/mcrypt.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/odbc.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_odbc.ini, /etc/php.d/pdo_sqlite.ini, /etc/php.d/xdebug.ini, /etc/php.d/xmlreader.ini, /etc/php.d/xmlrpc.ini, /etc/php.d/xmlwriter.ini, /etc/php.d/xsl.ini, /etc/php.d/zip.ini
      PHP API	20041225
      PHP Extension	20060613
      Zend Extension	220060519
      Debug Build	no
      Thread Safety	disabled
      Zend Memory Manager	enabled
      IPv6 Support	enabled
      Registered PHP Streams	php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps, zip
      Registered Stream Socket Transports	tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
      Registered Stream Filters	string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, bzip2.*, zlib.*
      
      This program makes use of the Zend Scripting Language Engine:
      Zend*Engine*v2.2.0,*Copyright*(c)*1998-2008*Zend*Technologies
      ****with*eAccelerator*v0.9.5.2,*Copyright*(c)*2004-2006*eAccelerator,*by*eAccelerator

        You might want to look in that config listing to see if anything is specified for the disable_functions setting, or just run a little script to find out:

        echo ini_get('disable_functions');
        
          NogDog;10974656 wrote:

          You might want to look in that config listing to see if anything is specified for the disable_functions setting, or just run a little script to find out:

          echo ini_get('disable_functions');
          

          Thanks for your help but this command comes up empty. 🙁

            The problem is that if the error_reporting() function was disabled then you would see a different error message.

            @: Is this your server (e.g. you have root access) or just an account on a shared host? If it's the former, I would suggest you try updating to the latest PHP version and seeing if the problem persists. If it's the latter, then I would put in a support ticket to your provider and briefly explain what's going on; if they can't give an explanation (or, more importantly, a solution) then I would suggest finding a better host (there are tons of 'em out there).

              Afraid that's about all I could think of, outside of a faulty PHP build for some reason. Does this error occur anywhere the function is used (for example a little one-line script that just calls that function), or only in certain scripts?

                Write a Reply...