Hi,
How do you test CGI or FastCGI program ?
testing CGI or FastCGI
testing CGI or FastCGI

Re: testing CGI or FastCGI
Thats a good question. I install XAMPP to try this out. The original Perl CGI scripts are ok.
But how should i compile a PB CGI ?
all try's result in : Error 500 - Premature end of script headers
And by the way, the CGI example in the internal help (F1) is not avaible...
But how should i compile a PB CGI ?
all try's result in : Error 500 - Premature end of script headers
And by the way, the CGI example in the internal help (F1) is not avaible...
Re: testing CGI or FastCGI
Hi,
I compile it on linux, install it in an apache web content and test it with a web browser.
I always generate a logfile where I can put out informations.
I prefer SCGI over FastCGI.
It was faster and easier to handle.
http://www.purebasic.fr/english/viewtop ... 12&t=58776
Bernd
I compile it on linux, install it in an apache web content and test it with a web browser.
I always generate a logfile where I can put out informations.
I prefer SCGI over FastCGI.
It was faster and easier to handle.
http://www.purebasic.fr/english/viewtop ... 12&t=58776
Bernd
Last edited by infratec on Tue Sep 01, 2015 7:08 am, edited 1 time in total.
Re: testing CGI or FastCGI
To test CGI on Windows, I installed "easyphp" http://www.easyphp.org/ , which install all needed tools, then added this to the apache conf file:
and uncommented the lines:
Once restarted, apache should redirect the url http://localhost/testfcgi to the port 5600
Then compile the example found in WaitFastCGIRequest() doc and it should work.
On linux, you need to do the same (installing apache and enabling mod proxy fastcgi)
Code: Select all
ProxyPass /testfcgi/ fcgi://localhost:5600/
Code: Select all
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
Then compile the example found in WaitFastCGIRequest() doc and it should work.
On linux, you need to do the same (installing apache and enabling mod proxy fastcgi)
Re: testing CGI or FastCGI
it seems, that #PB_CGI_LastHeader doesn't work. So (at the moment) you have to add an extra line break by yourself.Bisonte wrote:all try's result in : Error 500 - Premature end of script headers
doesn't work:
Code: Select all
If Not InitCGI() Or Not ReadCGI()
End
EndIf
WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html", #PB_CGI_LastHeader)
WriteCGIString("<html><title>PureBasic - test</title><body>" +
"Hello from PureBasic CGI<br>" +
"Actual time: <b>"+FormatDate("%hh:%ii", Date()) + "</b>" +
"</body></html>")
Code: Select all
If Not InitCGI() Or Not ReadCGI()
End
EndIf
WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html", #PB_CGI_LastHeader)
WriteCGIString(#CRLF$) ; <-- !!!
WriteCGIString("<html><title>PureBasic - test</title><body>" +
"Hello from PureBasic CGI<br>" +
"Actual time: <b>"+FormatDate("%hh:%ii", Date()) + "</b>" +
"</body></html>")
Hygge
Re: testing CGI or FastCGI
True, it's fixed, thanks.
Re: testing CGI or FastCGI
For use with Microsoft IIS, you need to check the ProgramParameter() first.
You'll get something like this: Port = 5600
Unfortunately, WaitFastCGIRequest() seems not work with IIS.
With ProcessExplorer running, I see that w3wp.exe (IIS) starts my fastcgi app,
but WaitFastCGIRequest() will not leaved..
Can someone help?
You'll get something like this: Port = 5600
Unfortunately, WaitFastCGIRequest() seems not work with IIS.
With ProcessExplorer running, I see that w3wp.exe (IIS) starts my fastcgi app,
but WaitFastCGIRequest() will not leaved..
Can someone help?
"Daddy, I'll run faster, then it is not so far..."