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

    [HOWTO] Captive portal + FreeRADIUS + local MySQL user friendly single step

    Scheduled Pinned Locked Moved Captive Portal
    154 Posts 47 Posters 106.9k 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.
    • M
      MasterBill
      last edited by

      Ahhh I see your right. I must have missed that some how. Anyway thanks again!

      1 Reply Last reply Reply Quote 0
      • N
        novensiles
        last edited by

        Hallo,

        I did all fine but get

        PHP ERROR: Type: 1, File: /var/etc/captiveportal_oberemuehle.html, Line: 126, Message: Call to undefined function mysql_connect()

        after typed in registring datas and send it.

        php56-mysql  is Installed

        All Packages Updated + Upgraded

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

          On a brand new pfsense 2.3-RELEASE (amd64)

          I have edited /usr/local/etc/pkg/repos/pfSense.conf and set the following value:

          FreeBSD: { enabled: yes }
          

          I have then run :

          pkg update
          

          Then:

          pkg install nano git
          

          This then results in:

          
          pkg install nano git
          Updating FreeBSD repository catalogue...
          FreeBSD repository is up-to-date.
          Updating pfSense-core repository catalogue...
          pfSense-core repository is up-to-date.
          Updating pfSense repository catalogue...
          pfSense repository is up-to-date.
          All repositories are up-to-date.
          New version of pkg detected; it needs to be installed first.
          The following 1 package(s) will be affected (of 0 checked):
          
          Installed packages to be REINSTALLED:
                  pkg-1.6.2 [pfSense]
          
          2 MiB to be downloaded.
          
          Proceed with this action? [y/N]: y
          Fetching pkg-1.6.2.txz: 100%    2 MiB 632.9kB/s    00:04
          Checking integrity... done (0 conflicting)
          [1/1] Reinstalling pkg-1.6.2...
          You may need to manually remove /usr/local/etc/pkg.conf if it is no longer needed.
          [1/1] Extracting pkg-1.6.2: 100%
          Message from pkg-1.6.2:
          If you are upgrading from the old package format, first run:
          
            # pkg2ng
          Updating FreeBSD repository catalogue...
          FreeBSD repository is up-to-date.
          Updating pfSense-core repository catalogue...
          pfSense-core repository is up-to-date.
          Updating pfSense repository catalogue...
          pfSense repository is up-to-date.
          All repositories are up-to-date.
          New version of pkg detected; it needs to be installed first.
          Checking integrity... done (0 conflicting)
          The most recent version of packages are already installed
          Updating FreeBSD repository catalogue...
          FreeBSD repository is up-to-date.
          Updating pfSense-core repository catalogue...
          pfSense-core repository is up-to-date.
          Updating pfSense repository catalogue...
          pfSense repository is up-to-date.
          All repositories are up-to-date.
          New version of pkg detected; it needs to be installed first.
          
          

          This then loops over and over and does not stop.

          The same then happens if I run

          pkg install mysql56-server
          

          What am I missing please?

          1 Reply Last reply Reply Quote 0
          • N
            nimamhd
            last edited by

            This is the bug of pkg and will fix in pkg 1.7.2:

            https://github.com/freebsd/pkg/issues/1303

            "" pkg infinite loop with multiple repos containing different versions of pkg ""

            you can comment out all other repo and install what you want, then restore the configuration to default.

            after install, the pkg will update to the last version that may cause the pfsense package system stop working, to resolve this:

            run:

            "pkg delete -f pkg" and install it again with pfsense repo.

            1 Reply Last reply Reply Quote 0
            • ?
              A Former User
              last edited by

              Hello Ozy, thank you so much for taking the time to do this. I can not stress how helpful this is!

              I know this is a lot to ask but if anyone is considering to make a how to video I would really appreciate this. I am not so fluent in this type of configuration. Thank you!

              1 Reply Last reply Reply Quote 1
              • B
                beewolf
                last edited by

                I have set the FreeBSD: { enabled: yes } but when I try to install the mysql56-server I get:

                Updating pfSense-core repository catalogue…
                pfSense-core repository is up-to-date.
                Updating pfSense repository catalogue...
                pfSense repository is up-to-date.
                All repositories are up-to-date.
                pkg: No packages available to install matching 'mysql56-server' have been found in the repositories

                Almost as if it is not looking in the FreeBSD repo.

                I have restarted after enabling FreeBSD and gone back in to check that it is enabled.

                Any ideas?  Thanks

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

                  Hi,

                  I've updated the captive portal code a couple of days ago with some bug fixes and minor improvements.
                  Sorry for not having answered earlier, been in holidays :)

                  @novensiles: can you give the output of "php -m" ?
                  @abebraham: sorry, but I think the text howto is enough. It's also easier to update it than to update a video. Feel free to ask for help here on the forum or github.
                  @beewolf: Repo files slightly changed between 2.3-RC and 2.3 final. I've updated the doc for this.

                  NetPOWER.fr - some opensource stuff for IT people

                  1 Reply Last reply Reply Quote 0
                  • B
                    beewolf
                    last edited by

                    Many thanks for that - all installed fine with those changes but I am getting the following error on trying to log in:

                    PHP ERROR: Type 1, File /var/etc/captiveortal_guest_wifi.html, Line 127, Message: Call to undefined functionmysql_connect()

                    Probably something I have done but am struggling to find what exactly.  Any ideas?  Thanks

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

                      What's your output of php -m ?

                      NetPOWER.fr - some opensource stuff for IT people

                      1 Reply Last reply Reply Quote 0
                      • B
                        beewolf
                        last edited by

                        [2.3.1-RELEASE][root@pfSense.skh]/root/pfsense-cp-auth-onestep/sql: php -m

                        
                        bcmath
                        bz2
                        Core
                        ctype
                        curl
                        date
                        dom
                        ereg
                        filter
                        gettext
                        hash
                        json
                        ldap
                        libxml
                        mbstring
                        mcrypt
                        mhash
                        mysql
                        mysqlnd
                        openssl
                        pcntl
                        pcre
                        PDO
                        pdo_sqlite
                        pfSense
                        posix
                        radius
                        readline
                        Reflection
                        rrd
                        session
                        shmop
                        SimpleXML
                        sockets
                        SPL
                        sqlite3
                        ssh2
                        standard
                        suhosin
                        sysvmsg
                        sysvsem
                        sysvshm
                        tokenizer
                        xdebug
                        xml
                        xmlreader
                        xmlwriter
                        Zend OPcache
                        zlib
                        zmq
                        
                        [Zend Modules]
                        Xdebug
                        Zend OPcache
                        
                        
                        1 Reply Last reply Reply Quote 0
                        • D
                          deajan
                          last edited by

                          It seems that the mysql extension is there.
                          Can you please restart php-fpm ? And if it does not work, restart pfSense ?

                          NetPOWER.fr - some opensource stuff for IT people

                          1 Reply Last reply Reply Quote 0
                          • B
                            beewolf
                            last edited by

                            Yes, thank you that worked - I should have tried that first!!

                            All seems to be working now in a test environment - just one thing, Freeradius needs to be started manually after a restart.  Is this usual?  Would it be possible to add the service to the MySQL cron job so it definitely starts automatically?

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

                              I'll add a note about rebooting to the guide.

                              As for the freeradius service, it depends on mysql service.
                              As there is no loading order, sometimes freeradius loads before mysql and may fail.

                              In order to get FreeRADIUS working all the time, I've setup the watchdog package to restart failing services.

                              NetPOWER.fr - some opensource stuff for IT people

                              1 Reply Last reply Reply Quote 0
                              • B
                                beewolf
                                last edited by

                                Many thanks - all working now.

                                1 Reply Last reply Reply Quote 0
                                • N
                                  novensiles
                                  last edited by

                                  
                                  bcmath
                                  bz2
                                  Core
                                  ctype
                                  curl
                                  date
                                  dom
                                  ereg
                                  filter
                                  gettext
                                  hash
                                  json
                                  ldap
                                  libxml
                                  mbstring
                                  mcrypt
                                  mhash
                                  mysql
                                  mysqli
                                  mysqlnd
                                  openssl
                                  pcntl
                                  pcre
                                  PDO
                                  pdo_sqlite
                                  pfSense
                                  posix
                                  radius
                                  readline
                                  Reflection
                                  rrd
                                  session
                                  shmop
                                  SimpleXML
                                  sockets
                                  SPL
                                  sqlite3
                                  ssh2
                                  standard
                                  suhosin
                                  sysvmsg
                                  sysvsem
                                  sysvshm
                                  tokenizer
                                  xdebug
                                  xml
                                  xmlreader
                                  xmlwriter
                                  Zend OPcache
                                  zlib
                                  zmq
                                  
                                  [Zend Modules]
                                  Xdebug
                                  Zend OPcache
                                  
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    deajan
                                    last edited by

                                    As stated above, you have the php mysql extension.
                                    Please restart php-fpm from console and try again.

                                    NetPOWER.fr - some opensource stuff for IT people

                                    1 Reply Last reply Reply Quote 0
                                    • B
                                      beewolf
                                      last edited by

                                      My system has been running fine for a week - I had to restart to get the cables sorted neatly and now whatever I do I cant get Freeradius to start.  There is another post here:

                                      https://forum.pfsense.org/index.php?topic=109775.msg611138#msg611138

                                      with similar symptoms to what I am getting and I have tried the suggestions in that but no difference.

                                      I realise that this is probably a freeradius/pfsense problem but really need some help sorting it - I don't want to have to rebuild again!

                                      Many thanks

                                      1 Reply Last reply Reply Quote 0
                                      • ?
                                        A Former User
                                        last edited by

                                        is it possible to use a node.js file for the captive portal? Or using mongodb?

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

                                          @abebraham:

                                          is it possible to use a node.js file for the captive portal? Or using mongodb?

                                          and why posting the same question twice ? https://forum.pfsense.org/index.php?topic=115337.0

                                          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
                                          • N
                                            nhimcoi30889
                                            last edited by

                                            Hello Deajan,
                                            Thank for guideline detail .
                                            I have a problem when install
                                            This is log :

                                            Warning: Illegal string offset 'alias' in /etc/inc/util.inc on line 1684 Call Stack: 0.0583 234136 1\. {main}() /usr/local/www/services_captiveportal.php:0 0.0584 234576 2\. require_once('/etc/inc/functions.inc') /usr/local/www/services_captiveportal.php:66 0.0586 234952 3\. require_once('/etc/inc/interfaces.inc') /etc/inc/functions.inc:170 0.0591 254296 4\. require_once('/etc/inc/gwlb.inc') /etc/inc/interfaces.inc:61 0.0591 254928 5\. require_once('/etc/inc/config.inc') /etc/inc/gwlb.inc:54 0.0595 265032 6\. parse_config() /etc/inc/config.inc:218 0.0598 372400 7\. alias_make_table() /etc/inc/config.lib.inc:185 Warning: Cannot modify header information - headers already sent by (output started at /etc/inc/util.inc:1684) in /usr/local/www/guiconfig.inc on line 72 Call Stack: 0.0583 234136 1\. {main}() /usr/local/www/services_captiveportal.php:0 0.0618 938296 2\. require_once('/usr/local/www/guiconfig.inc') /usr/local/www/services_captiveportal.php:75 0.0618 958632 3\. header() /usr/local/www/guiconfig.inc:72 Warning: Cannot modify header information - headers already sent by (output started at /etc/inc/util.inc:1684) in /usr/local/www/guiconfig.inc on line 73 Call Stack: 0.0583 234136 1\. {main}() /usr/local/www/services_captiveportal.php:0 0.0618 938296 2\. require_once('/usr/local/www/guiconfig.inc') /usr/local/www/services_captiveportal.php:75 0.0620 958760 3\. header() /usr/local/www/guiconfig.inc:73 Warning: Cannot modify header information - headers already sent by (output started at /etc/inc/util.inc:1684) in /usr/local/www/guiconfig.inc on line 74 Call Stack: 0.0583 234136 1\. {main}() /usr/local/www/services_captiveportal.php:0 0.0618 938296 2\. require_once('/usr/local/www/guiconfig.inc') /usr/local/www/services_captiveportal.php:75 0.0621 958696 3\. header() /usr/local/www/guiconfig.inc:74 Warning: Cannot modify header information - headers already sent by (output started at /etc/inc/util.inc:1684) in /usr/local/www/guiconfig.inc on line 75 Call Stack: 0.0583 234136 1\. {main}() /usr/local/www/services_captiveportal.php:0 0.0618 938296 2\. require_once('/usr/local/www/guiconfig.inc') /usr/local/www/services_captiveportal.php:75 0.0622 958696 3\. header() /usr/local/www/guiconfig.inc:75 Warning: Cannot modify header information - headers already sent by (output started at /etc/inc/util.inc:1684) in /usr/local/www/guiconfig.inc on line 78 Call Stack: 0.0583 234136 1\. {main}() /usr/local/www/services_captiveportal.php:0 0.0618 938296 2\. require_once('/usr/local/www/guiconfig.inc') /usr/local/www/services_captiveportal.php:75 0.0623 958696 3\. header() /usr/local/www/guiconfig.inc:78 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /etc/inc/util.inc:1684) in /etc/inc/auth.inc on line 1573 Call Stack: 0.0583 234136 1\. {main}() /usr/local/www/services_captiveportal.php:0 0.0618 938296 2\. require_once('/usr/local/www/guiconfig.inc') /usr/local/www/services_captiveportal.php:75 0.0624 959088 3\. require_once('/etc/inc/authgui.inc') /usr/local/www/guiconfig.inc:79 0.0812 1242720 4\. session_auth() /etc/inc/authgui.inc:62 0.0812 1244776 5\. session_start() /etc/inc/auth.inc:1573 Warning: Cannot modify header information - headers already sent by (output started at /etc/inc/util.inc:1684) in /usr/local/www/services_captiveportal.php on line 87 Call Stack: 0.0583 234136 1\. {main}() /usr/local/www/services_captiveportal.php:0 0.0821 1277104 2\. header() /usr/local/www/services_captiveportal.php:87
                                            

                                            At the moment, i cant access Service/Captive Portal ( this show above ).

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