• PHP-CGI

    From alter ego@VERT/ALTERANT to Digital Man on Wednesday, March 04, 2020 13:46:07
    Hey DM,

    I was playing with PHP today, and I couldnt get php-cgi to work with a simple php file.

    In web/root I have a simple php file:

    root@48b41d63d7ae:/opt/sbbs# cat web/root/x.php
    <?php echo phpinfo(); ?>

    I set up PHP-CGI according to the wiki and it executes the x.php file:
    3/4 13:42:19 web 0030 Request: GET /x.php HTTP/1.1
    3/4 13:42:19 web 0030 Executing CGI: /opt/sbbs/web/root/x.php
    3/4 13:42:19 web 0030 CGI Process x.php still alive on client exit
    3/4 13:44:20 web 0030 Session timeout due to inactivity (120 seconds)
    3/4 13:44:20 web 0030 HTTP connection accepted from: 10.1.3.130 port 62868

    There are two problems:
    1) The CGI executes, but the start of the output includes the terminal server, so the browser doesnt render it properly:



    3/4 13:44:43 web 0030 Using handler /usr/bin/php-cgi to execute /opt/sbbs/web/root/x.php
    [Threads: 14 Sockets: 19 Clients: 1 Served: 20 Errors: 52] (?=Help): Content-type: text/html; charset=UTF-8

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><head>
    <style type="text/css">
    body {background-color: #fff; color: #222; font-family: sans-serif;}


    2) The script runs until the timeout - it should exit after the echo, but doesnt.

    Am I missing anything?
    ...deon


    ... Some of the crowd have decided to voice their opinion by staying away.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Digital Man@VERT to alter ego on Tuesday, March 03, 2020 21:28:37
    Re: PHP-CGI
    By: alter ego to Digital Man on Wed Mar 04 2020 01:46 pm

    Hey DM,

    I was playing with PHP today, and I couldnt get php-cgi to work with a simple php file.

    In web/root I have a simple php file:

    root@48b41d63d7ae:/opt/sbbs# cat web/root/x.php
    <?php echo phpinfo(); ?>

    When I last tested non-fast PHP-CGI support, I used a simple hello.php file: <?php
    Print "Hello, World!";


    I set up PHP-CGI according to the wiki and it executes the x.php file:
    3/4 13:42:19 web 0030 Request: GET /x.php HTTP/1.1
    3/4 13:42:19 web 0030 Executing CGI: /opt/sbbs/web/root/x.php
    3/4 13:42:19 web 0030 CGI Process x.php still alive on client exit
    3/4 13:44:20 web 0030 Session timeout due to inactivity (120 seconds)
    3/4 13:44:20 web 0030 HTTP connection accepted from: 10.1.3.130 port 62868

    There are two problems:
    1) The CGI executes, but the start of the output includes the terminal server, so the browser doesnt render it properly:



    3/4 13:44:43 web 0030 Using handler /usr/bin/php-cgi to execute /opt/sbbs/web/root/x.php
    [Threads: 14 Sockets: 19 Clients: 1 Served: 20 Errors: 52] (?=Help): Content-type: text/html; charset=UTF-8

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><head>
    <style type="text/css">
    body {background-color: #fff; color: #222; font-family: sans-serif;}

    Are you saying that "[Thread: 14 ..." gets send over HTTP? That would be really weird.

    2) The script runs until the timeout - it should exit after the echo, but doesnt.

    Am I missing anything?

    Yeah, but off hand I can't say what. For one, I run sbbs daemonized and it appears you aren't. Maybe there's a difference there.

    digital man

    Synchronet "Real Fact" #103:
    The official Synchronet YouTube channel went live on May 6, 2019
    Norco, CA WX: 62.6øF, 33.0% humidity, 1 mph SSE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From alter ego@VERT/ALTERANT to Digital Man on Wednesday, March 04, 2020 20:15:28
    Re: PHP-CGI
    By: Digital Man to alter ego on Tue Mar 03 2020 09:28 pm

    Are you saying that "[Thread: 14 ..." gets send over HTTP? That would be really weird.

    Yes.

    Yeah, but off hand I can't say what. For one, I run sbbs daemonized and it appears you aren't. Maybe there's a difference there.

    What would that be a difference?
    ...deon


    ... A closed mouth gathers no foot.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Digital Man@VERT to alter ego on Wednesday, March 04, 2020 10:22:28
    Re: PHP-CGI
    By: alter ego to Digital Man on Wed Mar 04 2020 08:15 pm

    Re: PHP-CGI
    By: Digital Man to alter ego on Tue Mar 03 2020 09:28 pm

    Are you saying that "[Thread: 14 ..." gets send over HTTP? That would be really weird.

    Yes.

    Yeah, but off hand I can't say what. For one, I run sbbs daemonized and it appears you aren't. Maybe there's a difference there.

    What would that be a difference?

    Well, it shouldn't be a difference, but that sbbs status/prompt output you're saying is going out over HTTP isn't ever sent to stdout when sbbs is run daemonized (there is no status/prompt).

    digital man

    This Is Spinal Tap quote #16:
    David St. Hubbins: I believe virtually everything I read...
    Norco, CA WX: 63.5øF, 38.0% humidity, 0 mph ENE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From alter ego@VERT/ALTERANT to Digital Man on Thursday, March 05, 2020 14:55:14
    Re: PHP-CGI
    By: Digital Man to alter ego on Wed Mar 04 2020 10:22 am

    Are you saying that "[Thread: 14 ..." gets send over HTTP? That
    would be really weird.
    Yes.

    So is there a fix for this?
    ...deon


    ... If you've got them by the balls, their hearts and minds will follow.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Digital Man@VERT to alter ego on Wednesday, March 04, 2020 22:55:37
    Re: PHP-CGI
    By: alter ego to Digital Man on Thu Mar 05 2020 02:55 pm

    Re: PHP-CGI
    By: Digital Man to alter ego on Wed Mar 04 2020 10:22 am

    Are you saying that "[Thread: 14 ..." gets send over HTTP? That
    would be really weird.
    Yes.

    So is there a fix for this?

    I have no idea what the cause is, so I can't fix it yet. Did you try any other CGI scripts (non-PHP)?

    digital man

    Synchronet/BBS Terminology Definition #40:
    IMAP = Internet Message Access Protocol
    Norco, CA WX: 56.9øF, 73.0% humidity, 0 mph SW wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From alter ego@VERT/ALTERANT to Digital Man on Thursday, March 05, 2020 21:12:11
    Re: PHP-CGI
    By: Digital Man to alter ego on Wed Mar 04 2020 10:55 pm

    I have no idea what the cause is, so I can't fix it yet. Did you try any other CGI scripts (non-PHP)?

    So yes, I've tried a perl script and a bash script.

    Each run for MaxCgiInactivity before rendering output.

    Each script just echos "Hello World",
    .pl:
    #!/usr/bin/perl
    print "Hello World\n";

    ## console ##
    3/5 20:46:22 web 0035 Request: GET /x.pl HTTP/1.1
    3/5 20:46:22 web 0035 Executing CGI: /opt/sbbs/web/root/x.pl
    3/5 20:48:22 web 0035 CGI Process x.pl still alive on client exit
    3/5 20:48:24 web 0035 CGI Process x.pl did not send data header termination 3/5 20:48:24 web 0035 !ERROR: 500 Internal Server Error (line 5885)
    3/5 20:48:25 web 0035 Session thread terminated (0 clients, 2 threads remain, 12 served)

    ## output ##
    [deon@d-1-1 ~]$ curl http://d-1-1.ipv4.leenooks.vpn:8888/x.pl
    3/5 20:46:22 web 0035 Using handler /usr/bin/perl to execute /opt/sbbs/web/root/x.pl

    <HTML>
    <HEAD>
    <!-- $Id: 500.html,v 1.4 2005/09/12 00:15:19 deuce Exp $ -->
    <TITLE>Internal Server Error</TITLE>
    </HEAD>
    <BODY>
    Internal Server Error!
    </BODY>
    </HTML>

    .sh:
    #!/bin/sh
    echo "Hello World!"

    ## console ##
    3/5 20:49:11 web 0035 HTTP connection accepted from: 10.1.3.11 port 51818
    3/5 20:49:11 web 0035 Request: GET /x.sh HTTP/1.1
    3/5 20:49:11 web 0035 Executing CGI: /opt/sbbs/web/root/x.sh
    3/5 20:51:11 web 0035 CGI Process x.sh still alive on client exit
    3/5 20:51:13 web 0035 CGI Process x.sh did not send data header termination 3/5 20:51:13 web 0035 !ERROR: 500 Internal Server Error (line 5885)
    3/5 20:51:14 web 0035 Session thread terminated (0 clients, 2 threads remain, 13 served)

    ## output ##
    [deon@d-1-1 ~]$ curl http://d-1-1.ipv4.leenooks.vpn:8888/x.sh
    3/5 20:49:11 web 0035 Using handler /bin/bash to execute /opt/sbbs/web/root/x.sh

    <HTML>
    <HEAD>
    <!-- $Id: 500.html,v 1.4 2005/09/12 00:15:19 deuce Exp $ -->
    <TITLE>Internal Server Error</TITLE>
    </HEAD>
    <BODY>
    Internal Server Error!
    </BODY>
    </HTML>

    .php:
    <?php
    echo "Hello World!";


    ## console ##
    3/5 20:57:59 web 0035 HTTP connection accepted from: 10.1.3.11 port 52608
    3/5 20:57:59 web 0035 Request: GET /x.php HTTP/1.1
    3/5 20:57:59 web 0035 Executing CGI: /opt/sbbs/web/root/x.php
    3/5 21:00:00 web 0035 Session timeout due to inactivity (120 seconds)
    3/5 21:00:01 web 0035 Session thread terminated (0 clients, 2 threads remain, 14 served)

    ## output ##
    [deon@d-1-1 ~]$ curl http://d-1-1.ipv4.leenooks.vpn:8888/x.php
    3/5 20:57:59 web 0035 Using handler /usr/bin/php-cgi to execute /opt/sbbs/web/root/x.php
    [Threads: 15 Sockets: 26 Clients: 1 Served: 14 Errors: 69] (?=Help): Content-type: text/html; charset=UTF-8

    Hello World!
    ...deon


    ... A liberal is a conservative who's been mugged by reality.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Digital Man@VERT to alter ego on Thursday, March 05, 2020 11:17:34
    Re: PHP-CGI
    By: alter ego to Digital Man on Thu Mar 05 2020 09:12 pm

    Re: PHP-CGI
    By: Digital Man to alter ego on Wed Mar 04 2020 10:55 pm

    I have no idea what the cause is, so I can't fix it yet. Did you try any other CGI scripts (non-PHP)?

    So yes, I've tried a perl script and a bash script.

    Each run for MaxCgiInactivity before rendering output.

    Each script just echos "Hello World",
    .pl:
    #!/usr/bin/perl
    print "Hello World\n";

    ## console ##
    3/5 20:46:22 web 0035 Request: GET /x.pl HTTP/1.1
    3/5 20:46:22 web 0035 Executing CGI: /opt/sbbs/web/root/x.pl
    3/5 20:48:22 web 0035 CGI Process x.pl still alive on client exit
    3/5 20:48:24 web 0035 CGI Process x.pl did not send data header termination 3/5 20:48:24 web 0035 !ERROR: 500 Internal Server Error (line 5885)
    3/5 20:48:25 web 0035 Session thread terminated (0 clients, 2 threads remain, 12 served)

    ## output ##
    [deon@d-1-1 ~]$ curl http://d-1-1.ipv4.leenooks.vpn:8888/x.pl
    3/5 20:46:22 web 0035 Using handler /usr/bin/perl to execute /opt/sbbs/web/root/x.pl

    <HTML>
    <HEAD>
    <!-- $Id: 500.html,v 1.4 2005/09/12 00:15:19 deuce Exp $ -->
    <TITLE>Internal Server Error</TITLE>
    </HEAD>
    <BODY>
    Internal Server Error!
    </BODY>
    </HTML>

    .sh:
    #!/bin/sh
    echo "Hello World!"

    ## console ##
    3/5 20:49:11 web 0035 HTTP connection accepted from: 10.1.3.11 port 51818 3/5 20:49:11 web 0035 Request: GET /x.sh HTTP/1.1
    3/5 20:49:11 web 0035 Executing CGI: /opt/sbbs/web/root/x.sh
    3/5 20:51:11 web 0035 CGI Process x.sh still alive on client exit
    3/5 20:51:13 web 0035 CGI Process x.sh did not send data header termination 3/5 20:51:13 web 0035 !ERROR: 500 Internal Server Error (line 5885)
    3/5 20:51:14 web 0035 Session thread terminated (0 clients, 2 threads remain, 13 served)

    ## output ##
    [deon@d-1-1 ~]$ curl http://d-1-1.ipv4.leenooks.vpn:8888/x.sh
    3/5 20:49:11 web 0035 Using handler /bin/bash to execute /opt/sbbs/web/root/x.sh

    <HTML>
    <HEAD>
    <!-- $Id: 500.html,v 1.4 2005/09/12 00:15:19 deuce Exp $ -->
    <TITLE>Internal Server Error</TITLE>
    </HEAD>
    <BODY>
    Internal Server Error!
    </BODY>
    </HTML>

    .php:
    <?php
    echo "Hello World!";


    ## console ##
    3/5 20:57:59 web 0035 HTTP connection accepted from: 10.1.3.11 port 52608 3/5 20:57:59 web 0035 Request: GET /x.php HTTP/1.1
    3/5 20:57:59 web 0035 Executing CGI: /opt/sbbs/web/root/x.php
    3/5 21:00:00 web 0035 Session timeout due to inactivity (120 seconds)
    3/5 21:00:01 web 0035 Session thread terminated (0 clients, 2 threads remain, 14 served)

    ## output ##
    [deon@d-1-1 ~]$ curl http://d-1-1.ipv4.leenooks.vpn:8888/x.php
    3/5 20:57:59 web 0035 Using handler /usr/bin/php-cgi to execute /opt/sbbs/web/root/x.php
    [Threads: 15 Sockets: 26 Clients: 1 Served: 14 Errors: 69] (?=Help): Content-type: text/html; charset=UTF-8

    Hello World!

    Okay, so whatever the problem is, it's not specific to php-cgi. Have you tried running sbbs daemonized? How are you invoking sbbs, exactly?

    digital man

    Synchronet "Real Fact" #58:
    The last version of Synchronet to run on MS-DOS and OS/2 was v2.30c (1999). Norco, CA WX: 69.8øF, 57.0% humidity, 5 mph NE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From alter ego@VERT/ALTERANT to Digital Man on Friday, March 06, 2020 09:49:40
    Re: PHP-CGI
    By: Digital Man to alter ego on Thu Mar 05 2020 11:17 am

    Okay, so whatever the problem is, it's not specific to php-cgi. Have you tried running sbbs daemonized? How are you invoking sbbs, exactly?

    I run SBBS in docker - so it's a foreground process, executed by "sbbs" with no arguments.
    ...deon


    ... There is no such thing as a nonracial society in a multiracial country.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Digital Man@VERT to alter ego on Thursday, March 05, 2020 15:00:47
    Re: PHP-CGI
    By: alter ego to Digital Man on Fri Mar 06 2020 09:49 am

    Re: PHP-CGI
    By: Digital Man to alter ego on Thu Mar 05 2020 11:17 am

    Okay, so whatever the problem is, it's not specific to php-cgi. Have you tried running sbbs daemonized? How are you invoking sbbs, exactly?

    I run SBBS in docker - so it's a foreground process, executed by "sbbs" with no arguments.

    It's very strange and unexpected that the stdout of sbbs would be sent over the HTTP server. If you run "sbbs -d" instead, how does it behave?

    digital man

    Synchronet "Real Fact" #78:
    Synchronet Match Maker had at one time over 4000 profiles of men and women. Norco, CA WX: 80.6øF, 27.0% humidity, 3 mph NE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From alter ego@VERT/ALTERANT to Digital Man on Friday, March 06, 2020 11:22:57
    Re: PHP-CGI
    By: Digital Man to alter ego on Thu Mar 05 2020 03:00 pm

    It's very strange and unexpected that the stdout of sbbs would be sent over the HTTP server. If you run "sbbs -d" instead, how does it behave?

    It does.

    But I cant use it, because it detaches from the terminal, which results in the container "dieing". In a container, a process needs to be the contianers "init", and I was using "sbbs" for that. I should be able to work around that, but was thinking it should be fixed on your side :P

    (Which gives me an idea - I can launch the container without STDIN, I'll try it.)

    [ time passes ]

    No, it didnt work, but better results: Starting the container with no tty and no stdin, yield this:

    [deon@d-1-1 ~]$ curl -I http://d-1-1.ipv4.leenooks.vpn:8888/x.php
    HTTP/1.1 200 OK
    Date: Fri, 06 Mar 2020 00:13:15 GMT
    Connection: Keep-Alive
    Server: Synchronet BBS for Linux Version 3.17
    Allow: GET, HEAD, POST, OPTIONS
    Accept-Ranges: none
    [deon@d-1-1 ~]$ curl http://d-1-1.ipv4.leenooks.vpn:8888/x.php

    C
    curl: (56) Problem (3) in the Chunked-Encoded data
    Hello W

    And the console reported:
    3/6 11:13:15 web 0034 HTTP connection accepted from: 10.1.3.11 port 37870
    3/6 11:13:15 web 0034 Request: HEAD /x.php HTTP/1.1
    3/6 11:13:15 web 0034 Executing CGI: /opt/sbbs/web/root/x.php
    3/6 11:13:16 web 0034 Session thread terminated (0 clients, 2 threads remain, 1 served)
    3/6 11:13:23 web 0034 HTTP connection accepted from: 10.1.3.11 port 37882
    3/6 11:13:23 web 0034 Request: GET /x.php HTTP/1.1
    3/6 11:13:23 web 0034 Executing CGI: /opt/sbbs/web/root/x.php
    3/6 11:13:23 web -001 Unable to send to peer
    3/6 11:13:23 web 0034 Session thread terminated (0 clients, 2 threads remain, 2 served)

    But it did complete BEFORE MaxCgiInactivity

    I also tested the scenario of having STDIN open and allocating a pseudo tty - the problem of the terminal server's output only appears (and the delay to MaxCGInactivity) when the pseudo tty is attached. (Opening or not STDIN has no affect.)

    BTW: FPM works, but that means I need to launch that before execing sbbs. (Which I can do, but I was hoping to not have idle process running, since its not really a core use case, nor will be used that often..)
    ...deon


    ... After all is said and done, a hell of a lot more is said than done.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Digital Man@VERT to alter ego on Thursday, March 05, 2020 16:38:02
    Re: PHP-CGI
    By: alter ego to Digital Man on Fri Mar 06 2020 11:22 am

    But I cant use it, because it detaches from the terminal, which results in the container "dieing". In a container, a process needs to be the contianers "init", and I was using "sbbs" for that. I should be able to work around that, but was thinking it should be fixed on your side :P

    I'm not clear what you mean: what should be fixed on my side?

    digital man

    Synchronet "Real Fact" #93:
    Synchronet v3.16c was released in August of 2015 (5 years after v3.15b).
    Norco, CA WX: 76.7øF, 34.0% humidity, 13 mph ENE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From alter ego@VERT/ALTERANT to Digital Man on Friday, March 06, 2020 14:34:06
    Re: PHP-CGI
    By: Digital Man to alter ego on Thu Mar 05 2020 04:38 pm

    I'm not clear what you mean: what should be fixed on my side?

    Why when invoking php-cgi (or any cgi), it is rendering more than what cgi is supposed to be rendering?

    IE: In the case of php, its rendering the status of the terminal server - and because of this, the browser is treating the output as "text" not "html" (and therefore not rendering it correctly).
    ...deon


    ... I don't think it's any less important for not being terribly important.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Digital Man@VERT to alter ego on Thursday, March 05, 2020 20:10:04
    Re: PHP-CGI
    By: alter ego to Digital Man on Fri Mar 06 2020 02:34 pm

    Re: PHP-CGI
    By: Digital Man to alter ego on Thu Mar 05 2020 04:38 pm

    I'm not clear what you mean: what should be fixed on my side?

    Why when invoking php-cgi (or any cgi), it is rendering more than what cgi is supposed to be rendering?

    That, I don't know. It doesn't seem to be happening like that for me. I'll do some more testing and confirm that regular old CGI scripts are working as expected still.

    IE: In the case of php, its rendering the status of the terminal server - and because of this, the browser is treating the output as "text" not "html" (and therefore not rendering it correctly).

    Yeah, that I get, but I do suspect it has something to do with your unique setup.

    digital man

    Synchronet "Real Fact" #69:
    You can purchase the BBS Documentary DVD set at http://bbsdocumentary.com/order/
    Norco, CA WX: 64.5øF, 64.0% humidity, 0 mph SE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to alter ego on Thursday, March 05, 2020 20:27:13
    Re: PHP-CGI
    By: Digital Man to alter ego on Thu Mar 05 2020 08:10 pm

    Re: PHP-CGI
    By: alter ego to Digital Man on Fri Mar 06 2020 02:34 pm

    Re: PHP-CGI
    By: Digital Man to alter ego on Thu Mar 05 2020 04:38 pm

    I'm not clear what you mean: what should be fixed on my side?

    Why when invoking php-cgi (or any cgi), it is rendering more than what cgi is supposed to be rendering?

    That, I don't know. It doesn't seem to be happening like that for me. I'll do some more testing and confirm that regular old CGI scripts are working as expected still.

    Just reconfirmed here on Linux and Windows, stdio CGI scripts/programs are piping their output through the web server just fine.

    digital man

    Synchronet "Real Fact" #50:
    JAM and Squish were considered before developing Synchronet Message Base format.
    Norco, CA WX: 64.2øF, 64.0% humidity, 0 mph SE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From alter ego@VERT/ALTERANT to Digital Man on Friday, March 06, 2020 16:41:49
    Re: PHP-CGI
    By: Digital Man to alter ego on Thu Mar 05 2020 08:10 pm

    Yeah, that I get, but I do suspect it has something to do with your unique setup.

    Yeah I'm stumped then.

    I've ported many things into docker over the years and this would be a first.

    I guess I can validate that by running it outside of docker.

    I'm also running this on buster - so I'll check its not buster related as well (I recall previous issues with buster...)

    Thanks...
    ...deon


    ... Heavy, adj.: Seduced by the chocolate side of the force.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From alter ego@VERT/ALTERANT to Digital Man on Monday, March 09, 2020 20:21:31
    Re: PHP-CGI
    By: alter ego to Digital Man on Fri Mar 06 2020 04:41 pm

    Yeah I'm stumped then.
    I'm also running this on buster - so I'll check its not buster related as well (I recall previous issues with buster...)

    So I'm further stumped by this problem.

    I compiled under stretch and didnt have the problem. To be sure, I recompiled the buster container, and no problem. I'm not sure if something was fixed in the last few days?

    Anyway, I've noticed another strange problem - when calling curl, I'm getting

    curl: (56) Problem (3) in the Chunked-Encoded data

    Yet, it seems to render OK in the browser. I did some further debugging, and found if the output was 2 chars or 7 chars in size, there was no chunk encoding error, however, if the output has other sizes there are.

    I did a curl trace of a 7 char output (no error) and compared that to an 8 char output - and this is the difference:

    [deon@d-1-1 sbbstest]$ diff 7 8
    17c17
    < 0010: 72 20 32 30 32 30 20 30 39 3a 30 36 3a 30 36 20 r 2020 09:06:06
    ---
    0010: 72 20 32 30 32 30 20 30 39 3a 30 35 3a 35 35 20 r 2020 09:05:55
    42,46c42,45
    < <= Recv data, 12 bytes (0xc)
    < 0000: 37 0d 0a 31 32 33 34 35 36 37 0d 0a 7..1234567..
    < <= Recv data, 5 bytes (0x5)
    < 0000: 30 0d 0a 0d 0a 0....
    < == Info: Connection #0 to host d-1-1.ipv4.leenooks.vpn left intact
    ---
    <= Recv data, 13 bytes (0xd)
    0000: 38 0d 0a 31 32 33 34 35 36 37 38 0d 0a 8..12345678..
    == Info: Problem (3) in the Chunked-Encoded data
    == Info: Closing connection 0

    IE:
    * The php script had 'echo "1234567";' and 'echo "12345678";' respectively.
    * The 7 char output rendered an extra 5 bytes: '30 0d 0a 0d 0a', and the 8 char output excluded that.
    * I tested with a curl to the home page (no x.php), and it renders that '30 0d 0a 0d 0a' after it.

    When I tested with a 2 byte output, it just hung there (until 120s timeout but no chunk encoding error - but with error curl: (18) transfer closed with outstanding read data remaining)

    Does this mean anything to you...?
    ...deon


    ... Classical music is the kind we keep thinking will turn into a tune.
    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Digital Man@VERT to alter ego on Monday, March 09, 2020 14:53:17
    Re: PHP-CGI
    By: alter ego to Digital Man on Mon Mar 09 2020 08:21 pm

    Re: PHP-CGI
    By: alter ego to Digital Man on Fri Mar 06 2020 04:41 pm

    Yeah I'm stumped then.
    I'm also running this on buster - so I'll check its not buster related as well (I recall previous issues with buster...)

    So I'm further stumped by this problem.

    I compiled under stretch and didnt have the problem. To be sure, I recompiled the buster container, and no problem. I'm not sure if something was fixed in the last few days?

    Not in sbbs.

    Anyway, I've noticed another strange problem - when calling curl, I'm getting

    curl: (56) Problem (3) in the Chunked-Encoded data

    Yet, it seems to render OK in the browser. I did some further debugging, and found if the output was 2 chars or 7 chars in size, there was no chunk encoding error, however, if the output has other sizes there are.

    I did a curl trace of a 7 char output (no error) and compared that to an 8 char output - and this is the difference:

    [deon@d-1-1 sbbstest]$ diff 7 8
    17c17
    < 0010: 72 20 32 30 32 30 20 30 39 3a 30 36 3a 30 36 20 r 2020 09:06:06

    Best to reach out to deuce in #synchronet (irc.synchro.net) on that one.

    digital man

    Synchronet "Real Fact" #97:
    Synchronet v3.12a was released on December 31st of 2004 (Rob's birthday). Norco, CA WX: 72.0øF, 34.0% humidity, 1 mph WSW wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Tracker1@VERT/TRN to alter ego on Sunday, March 15, 2020 23:28:23
    On 3/5/20 5:22 PM, alter ego wrote:
    But I cant use it, because it detaches from the terminal, which results in the container "dieing". In a container, a process needs to be the contianers "init", and I was using "sbbs" for that. I should be able to work around that, but was thinking it should be fixed on your side :P

    (Which gives me an idea - I can launch the container without STDIN, I'll try it.)

    Might be easier to use an nginx container setup for PHP, and have a configuration to reverse proxy *.ssjs etc to the SBBS web host. I'm
    doing that for my configuration right now (not php though), so I can
    host a different app and still get through to the synchronet api stuff.

    --
    Michael J. Ryan
    tracker1 +o Roughneck BBS

    ---
    þ Synchronet þ Roughneck BBS - coming back 2/2/20
  • From alterego@VERT/ALTERANT to Tracker1 on Monday, March 16, 2020 23:28:27
    Re: Re: PHP-CGI
    By: Tracker1 to alter ego on Sun Mar 15 2020 11:28 pm

    Might be easier to use an nginx container setup for PHP, and have a configuration to reverse proxy *.ssjs etc to the SBBS web host. I'm
    doing that for my configuration right now (not php though), so I can
    host a different app and still get through to the synchronet api stuff.

    Yeah thanks for the idea.

    Turned out to be an old bug, which Deuce fixed.

    In lieu of php-cgi, I could have run php-fpm (or your nginx idea too) - but I didnt want to have an mostly idle deamon running. php-cgi appears to be working now, which is great.
    ...deon


    ... Not one hundred percent efficient, of course.but nothing ever is.

    ---
    þ Synchronet þ Alterant | an SBBS in Docker on Pi!
  • From Tracker1@VERT/TRN to alterego on Thursday, March 19, 2020 22:12:00
    On 3/16/20 5:28 AM, alterego wrote:
    By: Tracker1 to alter ego on Sun Mar 15 2020 11:28 pm
    Might be easier to use an nginx container setup for PHP, and have
    a configuration to reverse proxy *.ssjs etc to the SBBS web host.
    I'm doing that for my configuration right now (not php though), so
    I can host a different app and still get through to the synchronet
    api stuff.

    Yeah thanks for the idea.

    Turned out to be an old bug, which Deuce fixed.

    In lieu of php-cgi, I could have run php-fpm (or your nginx idea too)
    - but I didnt want to have an mostly idle deamon running. php-cgi
    appears to be working now, which is great
    One thing to consider, even if it's mostly idle, when you get hit by say
    a search engine bot, you'll see much longer response time build up,
    memory and cpu usage when you are using php-cgi.

    --
    Michael J. Ryan
    tracker1 +o Roughneck BBS

    ---
    þ Synchronet þ Roughneck BBS - coming back 2/2/20