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

    PHP Fatal Error

    Scheduled Pinned Locked Moved General pfSense Questions
    49 Posts 11 Posters 19.6k 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.
    • stephenw10S
      stephenw10 Netgate Administrator
      last edited by

      Mmm, nothing obviously wrong there. Seems like it's unable to write the file for some other reason.

      1 Reply Last reply Reply Quote 0
      • W
        wralb
        last edited by

        I'm seeing the exact same error from time to time as @asv345h since upgrading to 23.01 . I'm also running an ng-6100 running 23.01 (for info, I have a APC UPS plugged in to a USB port). Everything was fine for a year before the upgrade.

        Here is an example:

        FreeBSD 14.0-CURRENT #0 plus-RELENG_23_01-n256037-6e914874a5e: Fri Feb 10 20:30:29 UTC 2023     root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-23_01-main/obj/amd64/VDZvZksF/var/jenkins/workspace/pfSense-Plus-snapshots-23_01-main/sources/FreeBS
        
        Crash report details:
        
        PHP Errors:
        [07-Mar-2023 11:26:53 Europe/London] PHP Fatal error:  Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /etc/inc/config.lib.inc:172
        Stack trace:
        #0 /etc/inc/config.lib.inc(172): fwrite(false, 'a:44:{s:7:"vers...')
        #1 /etc/inc/config.lib.inc(147): generate_config_cache(Array)
        #2 /etc/inc/config.inc(141): parse_config()
        #3 /etc/inc/gwlb.inc(25): require_once('/etc/inc/config...')
        #4 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...')
        #5 /etc/inc/notices.inc(26): require_once('/etc/inc/functi...')
        #6 /usr/local/bin/notify_monitor.php(24): include_once('/etc/inc/notice...')
        #7 {main}
          thrown in /etc/inc/config.lib.inc on line 172
        [07-Mar-2023 11:26:53 Europe/London] PHP Fatal error:  Uncaught ValueError: Path cannot be empty in /etc/inc/notices.inc:101
        Stack trace:
        #0 /etc/inc/notices.inc(101): fopen('', 'w')
        #1 /etc/inc/config.lib.inc(1162): file_notice('phperror', 'PHP ERROR: Type...', 'PHP errors')
        #2 [internal function]: pfSense_clear_globals()
        #3 {main}
          thrown in /etc/inc/notices.inc on line 101
        

        The timing of the error correlates closely with a gateway event:

        Mar  7 11:26:36 pfsense dpinger[88905]: exiting on signal 15
        Mar  7 11:26:36 pfsense dpinger[90399]: send_interval 500ms  loss_interval 2000ms  time_period 60000ms  report_interval 0ms  data_len 1  alert_interval 1000ms  latency_alarm 1000ms  loss_alarm 50%  dest_addr 86.25.176.1  bind_addr 86.25.183.166  identifier "WAN_DHCP "
        Mar  7 11:26:39 pfsense dpinger[90399]: exiting on signal 15
        Mar  7 11:26:39 pfsense dpinger[16144]: send_interval 500ms  loss_interval 2000ms  time_period 60000ms  report_interval 0ms  data_len 1  alert_interval 1000ms  latency_alarm 1000ms  loss_alarm 50%  dest_addr 86.25.176.1  bind_addr 86.25.183.166  identifier "WAN_DHCP "
        Mar  7 11:26:46 pfsense dpinger[16144]: exiting on signal 15
        Mar  7 11:26:46 pfsense dpinger[57987]: send_interval 500ms  loss_interval 2000ms  time_period 60000ms  report_interval 0ms  data_len 1  alert_interval 1000ms  latency_alarm 1000ms  loss_alarm 50%  dest_addr 86.25.176.1  bind_addr 86.25.183.166  identifier "WAN_DHCP "
        

        File system is ZFS with plenty of space and /tmp showing 480KB of 6.5GB used.

        O 1 Reply Last reply Reply Quote 0
        • O
          Overlord @wralb
          last edited by

          I have the same issue on all of my pfSense boxes - after the Upgrade to 23.01

          1 Reply Last reply Reply Quote 1
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            The exact same pair of php errors?

            This? https://redmine.pfsense.org/issues/14061

            Is there some common config all your installs share?

            1 Reply Last reply Reply Quote 1
            • A
              akghetto
              last edited by akghetto

              Any update on this error? I started getting it tonight.

              My main drive is defintely not full...

              [23.01-RELEASE][admin@host.domain]/root: df -h
              Filesystem                     Size    Used   Avail Capacity  Mounted on
              /dev/ufsid/59b7f3af0adccc14    100G    2.6G     89G     3%    /
              devfs                          1.0K    1.0K      0B   100%    /dev
              tmpfs                          4.0M    196K    3.8M     5%    /var/run
              devfs                          1.0K    1.0K      0B   100%    /var/dhcpd/dev
              

              //edit: nevermind... found patch c5faa351c1ef6d4555478a7f50b3a16ece7e0b2a on redmine. Sorry for the thread bump.

              1 Reply Last reply Reply Quote 1
              • J
                jacksnack2
                last edited by jacksnack2

                Same issue here. Seen this error twice after upgrading to 2.7.0 on July 1st.

                I also see references to Nut Package (which is installed).

                I applied the patch as referenced above, I'll report back with results.

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

                  I just received this error again this morning. Patch has been applied at last posting date.

                  1 Reply Last reply Reply Quote 0
                  • stephenw10S
                    stephenw10 Netgate Administrator
                    last edited by

                    What error exactly?

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      jacksnack2 @stephenw10
                      last edited by

                      @stephenw10

                      Please see the error listed at the top of the post.

                      America/New_York] PHP Fatal error:  Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /etc/inc/config.lib.inc:172
                      
                      1 Reply Last reply Reply Quote 0
                      • stephenw10S
                        stephenw10 Netgate Administrator
                        last edited by

                        But not the error in /etc/inc/notices.inc:101 ?

                        J 1 Reply Last reply Reply Quote 0
                        • J
                          jacksnack2 @stephenw10
                          last edited by

                          @stephenw10 This is the error:

                          [06-Aug-2023 10:05:02 America/New_York] PHP Fatal error:  Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /etc/inc/config.lib.inc:172
                          Stack trace:
                          #0 /etc/inc/config.lib.inc(172): fwrite(false, 'a:40:{s:7:"vers...')
                          #1 /etc/inc/config.lib.inc(147): generate_config_cache(Array)
                          #2 /etc/inc/config.inc(141): parse_config()
                          #3 /etc/inc/gwlb.inc(25): require_once('/etc/inc/config...')
                          #4 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...')
                          #5 /etc/inc/notices.inc(26): require_once('/etc/inc/functi...')
                          #6 /usr/local/pkg/nut/nut_email.php(24): require_once('/etc/inc/notice...')
                          #7 {main}
                            thrown in /etc/inc/config.lib.inc on line 172
                          [06-Aug-2023 10:05:02 America/New_York] PHP Fatal error:  Uncaught ValueError: Path cannot be empty in /etc/inc/notices.inc:101
                          Stack trace:
                          #0 /etc/inc/notices.inc(101): fopen('', 'w')
                          #1 /etc/inc/config.lib.inc(1148): file_notice('phperror', 'PHP ERROR: Type...', 'PHP errors')
                          #2 [internal function]: pfSense_clear_globals()
                          #3 {main}
                            thrown in /etc/inc/notices.inc on line 101
                          
                          
                          O 1 Reply Last reply Reply Quote 1
                          • O
                            Overlord @jacksnack2
                            last edited by

                            I installed all patches and get still this error:

                            PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 172, Message: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /etc/inc/config.lib.inc:172
                            Stack trace:
                            #0 /etc/inc/config.lib.inc(172): fwrite(false, 'a:44:{s:7:"vers...')
                            #1 /etc/inc/config.lib.inc(147): generate_config_cache(Array)
                            #2 /etc/inc/config.inc(141): parse_config()
                            #3 /etc/inc/gwlb.inc(25): require_once('/etc/inc/config...')
                            #4 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...')
                            #5 /usr/local/sbin/pfSsh.php(29): require_once('/etc/inc/functi...')
                            #6 {main}
                            thrown @ 2023-09-05 06:00:03

                            GertjanG 1 Reply Last reply Reply Quote 0
                            • GertjanG
                              Gertjan @Overlord
                              last edited by

                              @Overlord

                              Doesn't this look like PHP error after reboot ?

                              No "help me" PM's please. Use the forum, the community will thank you.
                              Edit : and where are the logs ??

                              1 Reply Last reply Reply Quote 0
                              • jimpJ
                                jimp Rebel Alliance Developer Netgate
                                last edited by

                                There is another change I committed a couple weeks ago that might help with that, 596a88fa42f0ac77bd2fc2be87b54457df11f64b but I'm not sure if it applies cleanly on a patched or unpatched release. You can try, though.

                                But the problem is still someone trying to do a function as a non-privileged user that should be performed by root.

                                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                Need help fast? Netgate Global Support!

                                Do not Chat/PM for help!

                                W 1 Reply Last reply Reply Quote 2
                                • W
                                  wralb @jimp
                                  last edited by

                                  Thanks @jimp

                                  As mentioned previously, I saw this on my 6100 (with the NUT package and an APC UPS) many times when running 23.01. FYI, I never saw it with 23.05 over several months, but saw it again with 23.05.1 (coinidence?).

                                  Anyway, I just installed all recommended patches plus commit 596a88fa42f0ac77bd2fc2be87b54457df11f64b and will report back if I experience this issue again.

                                  1 Reply Last reply Reply Quote 1
                                  • J
                                    jacksnack2
                                    last edited by

                                    I am still having issues as well. Watching the thread closely.

                                    1 Reply Last reply Reply Quote 0
                                    • D
                                      dersch
                                      last edited by dersch

                                      I'm here with a simliar error. Found after ACME reissued a new Cert

                                      /etc/rc.restart_webgui
                                      Restarting webConfigurator...Error: cannot open certificate file in system_webgui_start().
                                      
                                      Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /etc/inc/rrd.inc:1027
                                      Stack trace:
                                      #0 /etc/inc/rrd.inc(1027): fwrite(false, '#!/bin/sh\n\nexpo...')
                                      #1 /etc/rc.restart_webgui(44): enable_rrd_graphing()
                                      #2 {main}
                                        thrown in /etc/inc/rrd.inc on line 1027
                                      PHP ERROR: Type: 1, File: /etc/inc/rrd.inc, Line: 1027, Message: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in
                                      /etc/inc/rrd.inc:1027
                                      Stack trace:
                                      #0 /etc/inc/rrd.inc(1027): fwrite(false, '#!/bin/sh\n\nexpo...')
                                      #1 /etc/rc.restart_webgui(44): enable_rrd_graphing()
                                      #2 {main}
                                        thrown
                                      

                                      Running on Proxmox - PfSense+ 23.05.1 with ZFS

                                      43ec47f2-3779-4e0f-9375-4bd603a8f0d0-image.png

                                      GertjanG 1 Reply Last reply Reply Quote 0
                                      • stephenw10S
                                        stephenw10 Netgate Administrator
                                        last edited by

                                        Have you only seen that one time? If you remove the error does it return? Can you trigger it repeatably?

                                        D 1 Reply Last reply Reply Quote 0
                                        • D
                                          dersch @stephenw10
                                          last edited by

                                          @stephenw10 it is a permanent failure. The new LE Cert is not in use because of that error.

                                          1 Reply Last reply Reply Quote 0
                                          • stephenw10S
                                            stephenw10 Netgate Administrator
                                            last edited by

                                            So it regenerates exactly the same error everytime the ACME cert renew script runs?

                                            And this just started happening, it didn't start after upgrading for example?

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