[Solved] Captive Portal Errors

  • 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

  • LAYER 8 Netgate

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

    php -l /etc/inc/captiveportal.inc

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

  • 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.

  • @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…

  • LAYER 8 Netgate

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

  • 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?

  • LAYER 8 Netgate

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

  • 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.

  • 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

  • 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.

Log in to reply