Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    PfSense 2.3.1 PHP errors

    Scheduled Pinned Locked Moved General pfSense Questions
    14 Posts 2 Posters 5.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JorgeOliveira
      last edited by

      Please check if your /usr/local/etc/php/extensions.ini contains the following content:

      extension=bcmath.so
      extension=bz2.so
      extension=ctype.so
      extension=curl.so
      extension=dom.so
      extension=filter.so
      extension=gettext.so
      extension=hash.so
      extension=json.so
      extension=ldap.so
      extension=mbstring.so
      extension=mcrypt.so
      extension=openssl.so
      extension=pcntl.so
      extension=pdo.so
      extension=pdo_sqlite.so
      extension=pfSense.so
      extension=posix.so
      extension=radius.so
      extension=readline.so
      extension=rrd.so
      extension=session.so
      extension=shmop.so
      extension=simplexml.so
      extension=sockets.so
      extension=sqlite3.so
      extension=ssh2.so
      extension=suhosin.so
      extension=sysvmsg.so
      extension=sysvsem.so
      extension=sysvshm.so
      extension=tokenizer.so
      extension=xml.so
      extension=xmlreader.so
      extension=xmlwriter.so
      extension=zlib.so
      extension=zmq.so
      zend_extension=/usr/local/lib/php/20131226/opcache.so
      zend_extension=/usr/local/lib/php/20131226/xdebug.so
      

      I am pretty sure there is a thread about it somewhere but can't find it at the moment.

      This has happened in the past to some people in other GUI areas with another function:
      https://forum.pfsense.org/index.php?topic=107790.msg605022#msg605022

      My views have absolutely no warranty express or implied. Always do your own research.

      1 Reply Last reply Reply Quote 0
      • S
        SlackerDude
        last edited by

        Hey, thanks for replying so quickly.  my extensions.ini file contains only this:

        extension=bcmath.so
        extension=bz2.so
        extension=ctype.so
        extension=curl.so
        extension=dom.so
        extension=filter.so
        extension=gettext.so
        extension=hash.so
        extension=json.so
        extension=ldap.so
        extension=mbstring.so
        extension=mcrypt.so
        extension=openssl.so
        extension=pcntl.so
        extension=pdo.so
        extension=pdo_sqlite.so
        extension=pfSense.so
        extension=posix.so
        extension=radius.so
        extension=readline.so
        extension=rrd.so
        extension=session.so
        extension=shmop.so
        extension=simplexml.so
        extension=sockets.so
        extension=sqlite3.so
        extension=ssh2.so
        extension=suhosin.so
        extension=sysvmsg.so
        extension=sysvsem.so
        extension=sysvshm.so
        extension=tokenizer.so
        extension=xml.so
        extension=xmlreader.so
        extension=xmlwriter.so
        extension=zlib.so
        extension=zmq.so
        zend_extension=/usr/local/lib/php/20131226/opcache.so
        zend_extension=/usr/local/lib/php/20131226/xdebug.so

        Do I need to replace the above with the content from your post?  Is this generic or machine-specific?

        1 Reply Last reply Reply Quote 0
        • J
          JorgeOliveira
          last edited by

          That should be okay. gettext is mentioned in that file. Try restarting PHP-FPM and see if issue persists.

          My views have absolutely no warranty express or implied. Always do your own research.

          1 Reply Last reply Reply Quote 0
          • S
            SlackerDude
            last edited by

            Done.  Now I'll wait to see if there are any recurrences.  Thanks!

            1 Reply Last reply Reply Quote 0
            • J
              JorgeOliveira
              last edited by

              Just as final test.

              Running on shell / diag_command:

              php -m | grep gettext
              

              Should return gettext which would mean it is being correctly loaded.

              Regards,
              Jorge M. Oliveira

              My views have absolutely no warranty express or implied. Always do your own research.

              1 Reply Last reply Reply Quote 0
              • S
                SlackerDude
                last edited by

                I got the following:

                Shell Output - php -m | grep gettext

                gettext

                So that's good.  I am still getting the crash reports though.

                1 Reply Last reply Reply Quote 0
                • J
                  JorgeOliveira
                  last edited by

                  Just out of curiosity, do you have any packages installed? Run this and let me know if there is any output:

                  pkg info | grep -i pfsense-pkg
                  

                  My views have absolutely no warranty express or implied. Always do your own research.

                  1 Reply Last reply Reply Quote 0
                  • S
                    SlackerDude
                    last edited by

                    I do, in fact.  Here is the output:

                    Shell Output - pkg info | grep -i pfsense-pkg

                    pfSense-pkg-Avahi-1.11_2      pfSense package Avahi
                    pfSense-pkg-darkstat-3.1.2_1  pfSense package darkstat
                    pfSense-pkg-snort-3.2.9.1_12  pfSense package snort

                    1 Reply Last reply Reply Quote 0
                    • J
                      JorgeOliveira
                      last edited by

                      Something is calling php either at a point when configuration is not yet available or forcing it to load on defaults. I could not find anything doing that on the main system neither on those packages. Hence why no Xdebug stack trace at all (which would have been very helpful to find the source…)

                      I'd suggest a "dirty" workaround until someone finds the true origin of the problem.

                      Create a /etc/inc/globals_override.inc with this content:

                      
                      if (!function_exists('gettext')) {
                          function gettext($str) {
                              return $str;
                          }
                      }
                      

                      This will define that function, if it isn't otherwise available, and make that error gone for time being.

                      Regards,
                      Jorge M. Oliveira

                      My views have absolutely no warranty express or implied. Always do your own research.

                      1 Reply Last reply Reply Quote 0
                      • S
                        SlackerDude
                        last edited by

                        I have created the new file & put it in place, rebooted the system & made some notes as to what I've done thus far.  I will wait to see if it shows up again.  Thank you Jorge, for you help in this.  +1 for you!  :D

                        1 Reply Last reply Reply Quote 0
                        • S
                          SlackerDude
                          last edited by

                          Okay, so I'm still getting the error:

                          					Crash report begins.  Anonymous machine information:
                          
                          amd64
                          10.3-RELEASE-p3
                          FreeBSD 10.3-RELEASE-p3 #1 3ef16fb(RELENG_2_3_1): Tue May 17 19:34:13 CDT 2016     root@ce23-amd64-builder:/builder/pfsense-231/tmp/obj/builder/pfsense-231/tmp/FreeBSD-src/sys/pfSense
                          
                          Crash report details:
                          
                          PHP Errors:
                          [19-May-2016 15:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [19-May-2016 16:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [19-May-2016 17:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [19-May-2016 18:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [19-May-2016 19:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [19-May-2016 20:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [19-May-2016 21:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [19-May-2016 22:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [19-May-2016 23:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [20-May-2016 00:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [20-May-2016 01:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [20-May-2016 02:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [20-May-2016 03:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [20-May-2016 04:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          [20-May-2016 05:00:00 America/Anchorage] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399
                          
                          

                          I look at the referenced line in "notices.inc" and see this:

                          		log_error(sprintf(gettext('Could not send the message to %1$s -- Error: %2$s'), $to, $smtp->error));
                          

                          which lead me to reexamine my notification settings, which seem to be in order, since I am also getting Cron emails from the system reporting this:

                          X-Cron-Env: <shell= bin="" sh="">X-Cron-Env: <path= etc:="" bin:="" sbin:="" usr="" sbin="">X-Cron-Env: <home= var="" log="">X-Cron-Env: <logname=root>X-Cron-Env: <user=root>Can't open perl script "/usr/local/www/lightsquid/lightparser.pl": No such file or directory</user=root></logname=root></home=></path=></shell=> 
                          

                          While I would really like to know what is causing this, I've almost decided to execute a fresh install.  :(

                          1 Reply Last reply Reply Quote 0
                          • J
                            JorgeOliveira
                            last edited by

                            Definitely looks like leftover of packages uninstalled during 2.2.x to 2.3.x upgrade.

                            The last resort you have is, as you said, config.xml backup and reinstall from scratch.

                            My views have absolutely no warranty express or implied. Always do your own research.

                            1 Reply Last reply Reply Quote 0
                            • S
                              SlackerDude
                              last edited by

                              A clean install followed by a restore of all except packages seems to have worked a charm.  Luckily I don't use more than two or three packages.  Thanks again for the assistance!

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.