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

How is web GUI linked to freebsd and how does it work ?

Scheduled Pinned Locked Moved webGUI
11 Posts 3 Posters 1.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.
  • M
    Meijink
    last edited by Nov 16, 2020, 2:25 PM

    Hey everyone i'm new here. I'm currently studying pfsense source code and i were wondering how the web GUI was made (i noticed it has been done with php). What i wan't is to find out and understand how it's linked to the freebsd OS, how it is set to the address and can be reached through the browser etc... If someone can help me it would be very appreciated. Best regards

    PS : sry for my bad english ^^

    G 1 Reply Last reply Nov 16, 2020, 3:04 PM Reply Quote 0
    • G
      Gertjan @Meijink
      last edited by Nov 16, 2020, 3:04 PM

      @Meijink said in How is web GUI linked to freebsd and how does it work ?:

      I'm currently studying pfsense source code

      Continue studying.
      The GUI is a classic web server, nginx, rooted in /usr/local/www/ - and lots of code in /etc/inc/.
      Basically, when you validate a GUI page with settings, the usual FreeBSD shell command line commands are executed, or configuration files are reconstructed, and the belonging process is restarted so the new settings are taken in account.

      Just like your .... coffee machine, acces point, ISP router, your DSM from Syno, Plex, etc etc etc.

      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
      • M
        Meijink
        last edited by Nov 16, 2020, 4:05 PM

        Thanks for your reply i understood a lot now especially about how the GUI is developed. And how can the GUI made with php execute the BSD commands ? is there a particular way ? i looked for it in the files but coudn't guess how and where it was done.

        1 Reply Last reply Reply Quote 0
        • G
          Gertjan
          last edited by Nov 17, 2020, 6:39 AM

          PHP can do anything.

          Open a console/ssh connection, use option 8 and :

          cd /etc/inc/
          grep 'mwexec' *
              and
          grep ' exec(' *
          

          This is just an example.

          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
          • M
            Meijink
            last edited by Nov 17, 2020, 10:59 AM

            Good morning ^^, thanks again for your help. I made a tons of research and i got what were explaining. One last thing : would you recommend python for this ? (i assume it's possible with python so tell me if i'm wrong)

            1 Reply Last reply Reply Quote 0
            • G
              Gertjan
              last edited by Nov 17, 2020, 2:42 PM

              Using Python to study the pfSense source code ?
              I would use my eyes and brains.

              pfSense could get rewritten in Python some day.
              PHP has become, like BASIC in the past, too basic.
              If it was me, it would be C and or C++.

              Take note that pfSense isn't only PHP - the GUI is for 99% PHP, but pfSense is more then that.
              A modified FreeBSD kernel, a boatload of FreeBSD packages, some C code, a sniff of Python, a modified layout of the FreeBSD file system.

              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
              • M
                Meijink
                last edited by Nov 17, 2020, 2:50 PM

                I were meaning if you would recommend python to write the GUI instead of php or another language but i get your point there. I were actually just wondering why they would use php instead of another language. Thank for your help on this topic. Best regards.

                J 1 Reply Last reply Nov 17, 2020, 8:46 PM Reply Quote 0
                • G
                  Gertjan
                  last edited by Nov 17, 2020, 3:01 PM

                  @Meijink said in How is web GUI linked to freebsd and how does it work ?:

                  they would use php instead of another language

                  Check out where pfSense came from. That will fill in the why part.
                  Back then, in the darker ages, everybody that could read and write, could 'code' PHP - as BASIC in the ancient period.
                  In the past, pfSense was close to be rommable, with a minimal RAM needed as a scratch pad.

                  And believe it or not, PHP code was easily maintainable (in the past).
                  The other known web language was ASP but that needed an IIS server thus no very 'free'.

                  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
                  • J
                    JeGr LAYER 8 Moderator @Meijink
                    last edited by Nov 17, 2020, 8:46 PM

                    @Meijink said in How is web GUI linked to freebsd and how does it work ?:

                    I were meaning if you would recommend python to write the GUI instead of php or another language but i get your point there. I were actually just wondering why they would use php instead of another language. Thank for your help on this topic. Best regards.

                    Would they do it in Python? No.
                    Why? Because nowadays that's not what you would do to create a flexible webUI. If the UI will be redone I sincerely hope it will be the same way as in TNSR and use an API as ground layer (RESTCONF) and put a cli and UI on top of that. No playing around with a webstack but using a tiered architecture that can be expanded in multiple ways.

                    Don't forget to upvote 👍 those who kindly offered their time and brainpower to help you!

                    If you're interested, I'm available to discuss details of German-speaking paid support (for companies) if needed.

                    G M 2 Replies Last reply Nov 18, 2020, 8:13 AM Reply Quote 1
                    • G
                      Gertjan @JeGr
                      last edited by Nov 18, 2020, 8:13 AM

                      @JeGr said in How is web GUI linked to freebsd and how does it work ?:

                      use an API as ground layer (RESTCONF) and put a cli and UI on top of that.

                      Totally agree with that.
                      It will be a huge task, and thus I'll doubt it's economically feasible.

                      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 1
                      • M
                        Meijink @JeGr
                        last edited by Nov 18, 2020, 1:04 PM

                        @JeGr thanks for this intervention i didn't get everything about the technology you mentionned but i will try to find informations about it.
                        @Gertjan thanks again for your support through this topic it helped me a lot.

                        1 Reply Last reply Reply Quote 0
                        11 out of 11
                        • First post
                          11/11
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                          This community forum collects and processes your personal information.
                          consent.not_received