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

    [Solved] Captive Portal Errors

    Scheduled Pinned Locked Moved Captive Portal
    10 Posts 5 Posters 3.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.
    • A
      alltime
      last edited by

      Our Captive portal has been running fine for many months now. All of a sudden this week, after seeing that users were not being prompted to log-in, I encountered the below error when viewing the portal configuration page. Is anyone familiar with this?

      At this time, I can't even restart the portal service. The only thing that we've recently changed was our DHCP scope.

      Fatal error: Call to undefined function captiveportal_read_db() in /usr/local/www/services_captiveportal_zones.php on line 81

      1 Reply Last reply Reply Quote 0
      • DerelictD
        Derelict LAYER 8 Netgate
        last edited by

        Not sure but what are the outputs of these shell commands?

        php -l /etc/inc/captiveportal.inc

        php -l /usr/local/captiveportal/index.php

        Chattanooga, Tennessee, USA
        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
        Do Not Chat For Help! NO_WAN_EGRESS(TM)

        1 Reply Last reply Reply Quote 0
        • C
          cmb
          last edited by

          That means you changed something, or are somehow missing /etc/inc/captiveportal.inc. Most likely someone was manually changing source code, or it's possible that your drive has failed (at least partially) leaving some files unreadable.

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

            @UNet:

            Fatal error: Call to undefined function captiveportal_read_db() in /usr/local/www/services_captiveportal_zones.php on line 81

            Had that after one of my boxes crashed a while ago.
            I wasn't able to fix it! I had to reinstall my box and restore my config from the day before.

            As far as i know, the CP uses an SQLite database and that seems to get corrupted. But this is just a wild guess…

            Regards

            /JH

            1 Reply Last reply Reply Quote 0
            • DerelictD
              Derelict LAYER 8 Netgate
              last edited by

              That error is not indicative of a corrupt database.  Undefined function means it cannot even load the PHP function that reads the database.

              Chattanooga, Tennessee, USA
              A comprehensive network diagram is worth 10,000 words and 15 conference calls.
              DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
              Do Not Chat For Help! NO_WAN_EGRESS(TM)

              1 Reply Last reply Reply Quote 0
              • A
                alltime
                last edited by

                Very strange then. Perhaps I'll organize a reboot this weekend, hopefully it can correct itself. If I restore from backups, just the Captive Portal settings, do you think this might overwrite whatever might be corrupt? Or this simply might be DB/PHP related?

                1 Reply Last reply Reply Quote 0
                • DerelictD
                  Derelict LAYER 8 Netgate
                  last edited by

                  I would take a backup of your config.  Now.  It'll be what it is.  Your hardware is probably failing.

                  Chattanooga, Tennessee, USA
                  A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                  DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                  Do Not Chat For Help! NO_WAN_EGRESS(TM)

                  1 Reply Last reply Reply Quote 0
                  • C
                    cmb
                    last edited by

                    That has nothing to do with the config file, it's source in the base system it can't find. Reboot won't change that, and might make things worse.

                    Get a backup if you don't have a current one already in case it is the drive that's failed. Be prepared for it to not boot up again if you reboot it, as there is a chance a drive failure is the reason it can't read the captive portal source. I'd re-upgrade it by applying the appropriate update file under System>Firmware, manual update. That'll replace the file with a correct one, which will fix it if the cause is someone mucking with the source.

                    1 Reply Last reply Reply Quote 0
                    • M
                      mendilli
                      last edited by

                      I have had this eror when I replaced the captiveportal.inc from github, the database codes are different, I suggest you to get the captiveportal.inc from livecd iso and put it into your sistem with winnscp

                      1 Reply Last reply Reply Quote 0
                      • A
                        alltime
                        last edited by

                        After completing a full backup, we went ahead and re-installed the same firmware through the Web GUI. This corrected everything and we rebooted successfully. Thanks everyone for the help.

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