Custom PHP build configuration? [ANSWERED]



  • Hi,

    Can someone point me toward the PHP build configuration that ships with 2.2.3-RELEASE? I've searched GitHub but am I missing it? I'd like to build it myself and maybe update it.

    I realize that installing upstream FreeBSD packages is unsupported but I find joy in breaking and fixing my personal instance. The PHP version 5.5.26 that ships with 2.2.3-RELEASE has cgi-fcgi built in:

    [2.2.3-RELEASE][root@pfsense1]/root: php -v
    PHP 5.5.26 (cgi-fcgi) (built: Jun 12 2015 14:20:29)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
        with Suhosin v0.9.37.1, Copyright (c) 2007-2014, by SektionEins GmbH
    

    The upstream FreeBSD build separates the php and php-cgi binaries and doesn't have cgi-fcgi built-in. Php-fpm also behaves differently: the Unix socket writes out the script and Content-Type headers:

    PHP pfSense build 5.5.26 (WORKING):

    [2.2.3-RELEASE][root@pfsense1]/root: /usr/local/sbin/fcgicli -f /etc/inc/openvpn.tls-verify.php -d "test.test&depth=2&certdepth=1&certsubject=C=US,"; echo; echo $?
    OK
    0
    

    PHP FreeBSD build 5.5.27 (BROKEN):

    [2.2.3-RELEASE][root@pfsense2]/root: /usr/local/sbin/fcgicli -f /etc/inc/openvpn.tls-verify.php -d "test.test&depth=2&certdepth=1&certsubject=C=US,"; echo; echo $?
    Content-type: text/html
    
    #!/usr/local/bin/php -f
    OK
    0
    

    For me this breaks /usr/local/sbin/ovpn_auth_verify producing "WARNING: Failed running command (–tls-verify script): external program exited with error status: 1" and "VERIFY SCRIPT ERROR" messages since we only match on exactly "OK". So far this hasn't broken anything else that I'm aware of. Here is my patch if you want to continue using 5.5.27 with OpenVPN:

    Note: this may not be a good idea for high traffic OpenVPN servers as we add an extra system call to grep:

    ~~–- /usr/local/sbin/ovpn_auth_verify.orig      2015-07-18 19:04:15.000000000 -0600
    +++ /usr/local/sbin/ovpn_auth_verify    2015-07-18 19:04:50.000000000 -0600
    @@ -9,7 +9,7 @@
            RESULT=$(/usr/local/sbin/fcgicli -f /etc/inc/openvpn.auth-user.php -d "username=$username&password=$password&cn=$common_name&strictcn=$3&authcfg=$2&modeid=$4")
    fi

    -if [ "${RESULT}" = "OK" ]; then
    +if echo "${RESULT}" | /usr/bin/grep -E "^OK$" &> /dev/null; then
            exit 0
    fi~~

    EDIT: Here is a faster & much more elegant solution:

    --- /usr/local/sbin/ovpn_auth_verify.orig       2015-07-18 20:11:02.000000000 -0600
    +++ /usr/local/sbin/ovpn_auth_verify    2015-07-19 11:18:16.000000000 -0600
    @@ -9,8 +9,11 @@
            RESULT=$(/usr/local/sbin/fcgicli -f /etc/inc/openvpn.auth-user.php -d "username=$username&password=$password&cn=$common_name&strictcn=$3&authcfg=$2&modeid=$4")
     fi
    
    -if [ "${RESULT}" = "OK" ]; then
    -       exit 0
    -fi
    -
    -exit 1
    +case "$RESULT" in
    +   *"OK"*)
    +      exit 0
    +      ;;
    +   *)
    +      exit 1
    +      ;;
    +esac
    
    

    Thanks!



  • Anyone? This is supposed to be open source right? Do I need to be granted GitHub access? What am I missing?  ???



  • What am I missing?

    The fact that the vast majority of people here are users and not developers?  Maybe if you posted in the Development forum, that might get some eyeballs.



  • This is an excellent point. I'd overlooked the Development section. Thanks for your reply!


  • Rebel Alliance Global Moderator

    What are you saying is broken?

    [2.2.4-RELEASE][root@pfSense.local.lan]/root: php -v
    PHP 5.5.27 (cgi-fcgi) (built: Jul 13 2015 19:15:15)
    Copyright © 1997-2015 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
        with Suhosin v0.9.37.1, Copyright (c) 2007-2014, by SektionEins GmbH

    [2.2.4-RELEASE][root@pfSense.local.lan]/root: /usr/local/sbin/fcgicli -f /etc/inc/openvpn.tls-verify.php -d "test.test&depth=2&certdepth=1&certsubject=C=US,"; echo; echo $?
    OK
    0
    [2.2.4-RELEASE][root@pfSense.local.lan]/root: