Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-05

fpWeb FCGI Setup

21 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lee Jenkins

Hi all,

I'm trying to get fcgi setup and running on my windows box so I can test some of modules and I'm still try to figure out what I need to do.

A sample fcgi project produces an exception when run "Failed to open input handle passed from server. Socket error 10038.".

I had thought that the fcgi server just started and waited for connections from the webserver but it looks like it is trying to connect to an assume socket as soon as it starts. Sorry, I can't tell exactly, the ide won't let me debug down passed Application.Run line in the .lpr.

Not sure how I would debug like without it being started already...

Windows Vista, Lazarus snapshot a week or so old.

Thanks,

Warm Regards, Lee

Reply by email

ABorka
to Lee Jenkins
Show quoted text 23 lines
Hi all, I'm trying to get fcgi setup and running on my windows box so I can test some of modules and I'm still try to figure out what I need to do. A sample fcgi project produces an exception when run "Failed to open input handle passed from server. Socket error 10038.". I had thought that the fcgi server just started and waited for connections from the webserver but it looks like it is trying to connect to an assume socket as soon as it starts. Sorry, I can't tell exactly, the ide won't let me debug down passed Application.Run line in the .lpr. Not sure how I would debug like without it being started already... Windows Vista, Lazarus snapshot a week or so old. Thanks, -- Warm Regards, Lee

You need to specify the port your FCGI application will be listening on in your project main file (.lpr):

.
.
.

   Application.Title:='My FCGI Application';
   Application.Port:=2015;//Port the FCGI application is listening on
   Application.Initialize;
   Application.Run;

.
.
.

AB

Reply by email

Lee Jenkins
to ABorka
ABorka wrote 35 lines
> Hi all, > > I'm trying to get fcgi setup and running on my windows box so I can test > some of modules and I'm still try to figure out what I need to do. > > A sample fcgi project produces an exception when run "Failed to open > input handle passed from server. Socket error 10038.". > > I had thought that the fcgi server just started and waited for > connections from the webserver but it looks like it is trying to connect > to an assume socket as soon as it starts. Sorry, I can't tell exactly, > the ide won't let me debug down passed Application.Run line in the .lpr. > > Not sure how I would debug like without it being started already... > > Windows Vista, Lazarus snapshot a week or so old. > > Thanks, > > -- > Warm Regards, > > Lee You need to specify the port your FCGI application will be listening on in your project main file (.lpr): . . . Application.Title:='My FCGI Application'; Application.Port:=2015;//Port the FCGI application is listening on Application.Initialize; Application.Run; .

Sweet. I was looking around for sample conf. file generated, lol. I did add a new bug report suggesting that the comment above be added to newly created FastCGI .lpr files:

http://bugs.freepascal.org/view.php?id=19398

Thank you,

Warm Regards, Lee

Reply by email

Lee Jenkins
to ABorka: You need to specify the port your FCGI application will be listening on in your project…
ABorka wrote 35 lines
> Hi all, > > I'm trying to get fcgi setup and running on my windows box so I can test > some of modules and I'm still try to figure out what I need to do. > > A sample fcgi project produces an exception when run "Failed to open > input handle passed from server. Socket error 10038.". > > I had thought that the fcgi server just started and waited for > connections from the webserver but it looks like it is trying to connect > to an assume socket as soon as it starts. Sorry, I can't tell exactly, > the ide won't let me debug down passed Application.Run line in the .lpr. > > Not sure how I would debug like without it being started already... > > Windows Vista, Lazarus snapshot a week or so old. > > Thanks, > > -- > Warm Regards, > > Lee You need to specify the port your FCGI application will be listening on in your project main file (.lpr): . . . Application.Title:='My FCGI Application'; Application.Port:=2015;//Port the FCGI application is listening on Application.Initialize; Application.Run; .

I know its a bit off topic, but I've been trying to get fastcgi configured with apache off and on for a week now and I have yet to figure out the specific combination. My httpd.conf looks like this for fcgi:

LoadModule fcgid_module modules/mod_fcgid.so

<Directory "www/fcgi-bin">
SetHandler fcgid-script
Options execCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<ifModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi .fcg
Alias /fastcgi-bin "M:\LazProjs\test_projects\test_fpweb\www\pos.fcgi" FastCgiExternalServer "M:\LazProjs\test_projects\test_fpweb\www\pos.fcgi" -host 127.0.0.1:2015
</IfModule>

I've downloaded the fcgid .so and put it in the modules folder.

I've tried all manner of combination of directories, changing directories vs. settings in httpd.conf, etc. Just can't seem to get apache configured correctly. Most of what I've been able to find is scattered around in terms of any real examples of setting up fastcgi on apache. The apache server never hits the fcgi server for requests.

I convinced the client to let me put a prototype together and I'm about 5 days of trying at this point so any suggestion anyone might have about getting fastcgi with apache connecting to the lazarus fcgi server would be really appareciated. :-)

Warm Regards, Lee

Reply by email

ABorka
to Lee Jenkins
Show quoted text 76 lines
>> Hi all, >> >> I'm trying to get fcgi setup and running on my windows box so I can test >> some of modules and I'm still try to figure out what I need to do. >> >> A sample fcgi project produces an exception when run "Failed to open >> input handle passed from server. Socket error 10038.". >> >> I had thought that the fcgi server just started and waited for >> connections from the webserver but it looks like it is trying to connect >> to an assume socket as soon as it starts. Sorry, I can't tell exactly, >> the ide won't let me debug down passed Application.Run line in the .lpr. >> >> Not sure how I would debug like without it being started already... >> >> Windows Vista, Lazarus snapshot a week or so old. >> >> Thanks, >> >> -- >> Warm Regards, >> >> Lee > > You need to specify the port your FCGI application will be listening > on in your > project main file (.lpr): > > . > . > . > Application.Title:='My FCGI Application'; > Application.Port:=2015;//Port the FCGI application is listening on > Application.Initialize; > Application.Run; > . I know its a bit off topic, but I've been trying to get fastcgi configured with apache off and on for a week now and I have yet to figure out the specific combination. My httpd.conf looks like this for fcgi: LoadModule fcgid_module modules/mod_fcgid.so <Directory "www/fcgi-bin"> SetHandler fcgid-script Options execCGI AllowOverride None Order allow,deny Allow from all </Directory> <ifModule mod_fastcgi.c> AddHandler fastcgi-script .fcgi .fcg Alias /fastcgi-bin "M:\LazProjs\test_projects\test_fpweb\www\pos.fcgi" FastCgiExternalServer "M:\LazProjs\test_projects\test_fpweb\www\pos.fcgi" -host 127.0.0.1:2015 </IfModule> I've downloaded the fcgid .so and put it in the modules folder. I've tried all manner of combination of directories, changing directories vs. settings in httpd.conf, etc. Just can't seem to get apache configured correctly. Most of what I've been able to find is scattered around in terms of any real examples of setting up fastcgi on apache. The apache server never hits the fcgi server for requests. I convinced the client to let me put a prototype together and I'm about 5 days of trying at this point so any suggestion anyone might have about getting fastcgi with apache connecting to the lazarus fcgi server would be really appareciated. :-) -- Warm Regards, Lee

It seems you are trying to use the fcgid module that comes with Apache and Linux distributions.
That will not work most probably. You need the original fastcgi from the official website http://www.fastcgi.com/dist/ .

I did list steps for both Windows and Linux (you have to compile from sources on Linux) in this forums thread somewhere:

http://www.lazarus.freepascal.org/index.php/topic,12817.0.html

AB

Reply by email

Lee Jenkins
to ABorka
ABorka wrote 87 lines
>>> Hi all, >>> >>> I'm trying to get fcgi setup and running on my windows box so I can test >>> some of modules and I'm still try to figure out what I need to do. >>> >>> A sample fcgi project produces an exception when run "Failed to open >>> input handle passed from server. Socket error 10038.". >>> >>> I had thought that the fcgi server just started and waited for >>> connections from the webserver but it looks like it is trying to connect >>> to an assume socket as soon as it starts. Sorry, I can't tell exactly, >>> the ide won't let me debug down passed Application.Run line in the .lpr. >>> >>> Not sure how I would debug like without it being started already... >>> >>> Windows Vista, Lazarus snapshot a week or so old. >>> >>> Thanks, >>> >>> -- >>> Warm Regards, >>> >>> Lee >> >> You need to specify the port your FCGI application will be listening >> on in your >> project main file (.lpr): >> >> . >> . >> . >> Application.Title:='My FCGI Application'; >> Application.Port:=2015;//Port the FCGI application is listening on >> Application.Initialize; >> Application.Run; >> . > > I know its a bit off topic, but I've been trying to get fastcgi > configured with apache off and on for a week now and I have yet to > figure out the specific combination. My httpd.conf looks like this for > fcgi: > > LoadModule fcgid_module modules/mod_fcgid.so > > <Directory "www/fcgi-bin"> > SetHandler fcgid-script > Options execCGI > AllowOverride None > Order allow,deny > Allow from all > </Directory> > > <ifModule mod_fastcgi.c> > AddHandler fastcgi-script .fcgi .fcg > Alias /fastcgi-bin "M:\LazProjs\test_projects\test_fpweb\www\pos.fcgi" > FastCgiExternalServer > "M:\LazProjs\test_projects\test_fpweb\www\pos.fcgi" -host 127.0.0.1:2015 > </IfModule> > > I've downloaded the fcgid .so and put it in the modules folder. > > I've tried all manner of combination of directories, changing > directories vs. settings in httpd.conf, etc. Just can't seem to get > apache configured correctly. Most of what I've been able to find is > scattered around in terms of any real examples of setting up fastcgi on > apache. The apache server never hits the fcgi server for requests. > > I convinced the client to let me put a prototype together and I'm about > 5 days of trying at this point so any suggestion anyone might have about > getting fastcgi with apache connecting to the lazarus fcgi server would > be really appareciated. :-) > > -- > Warm Regards, > > Lee It seems you are trying to use the fcgid module that comes with Apache and Linux distributions. That will not work most probably. You need the original fastcgi from the official website http://www.fastcgi.com/dist/ . I did list steps for both Windows and Linux (you have to compile from sources on Linux) in this forums thread somewhere: http://www.lazarus.freepascal.org/index.php/topic,12817.0.html

Wow, I was way off. Thank you for that. Great stuff. Got me up and working like a champ. Thanks for your help.

Warm Regards, Lee

Reply by email

silvioprog
to Lee Jenkins: I know its a bit off topic, but I've been trying to get fastcgi configured with apache…

Hi.

I could never run a FastCGI module. :(

My steps (without success):

1. Download and install lasted XAMPP;
2. Download "http://www.fastcgi.com/dist/mod_fastcgi-2.4.6-AP22.dll" em copy to "C:\xampp\apache\modules\mod_fastcgi-2.4.6-AP22.dll";
3. Edit the "C:\xampp\apache\conf\httpd.conf" to:
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule fastcgi_module modules/mod_fastcgi-2.4.6-AP22.dll <IfModule mod_fastcgi.c>
FastCGIConfig -autoUpdate -idle-timeout 120 -killInterval 3600 -maxClassProcesses 3 -maxProcesses 15 -startDelay 30 AddHandler fastcgi-script .fcgi
</IfModule>
4. Restart Apache;
5. Create, compile and copy the my demo (in attached) to "C:\xampp\cgi-bin\test.fcgi";
6. Open in Firefox the link "http://localhost/cgi-bin/test.fcgi";

And not works. When I open the link, Firefox freezes, as if the module was on infinity loop.

How do I fix it?

Thx.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: FastCGI.zip Type: application/zip Size: 2200 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110526/24b68329/attachment.zip>

Reply by email

ABorka
to silvioprog
silvioprog wrote 28 lines
Hi. I could never run a FastCGI module. :( My steps (without success): 1. Download and install lasted XAMPP; 2. Download "http://www.fastcgi.com/dist/mod_fastcgi-2.4.6-AP22.dll" em copy to "C:\xampp\apache\modules\mod_fastcgi-2.4.6-AP22.dll"; 3. Edit the "C:\xampp\apache\conf\httpd.conf" to: LoadModule rewrite_module modules/mod_rewrite.so LoadModule fastcgi_module modules/mod_fastcgi-2.4.6-AP22.dll <IfModule mod_fastcgi.c> FastCGIConfig -autoUpdate -idle-timeout 120 -killInterval 3600 -maxClassProcesses 3 -maxProcesses 15 -startDelay 30 AddHandler fastcgi-script .fcgi </IfModule> 4. Restart Apache; 5. Create, compile and copy the my demo (in attached) to "C:\xampp\cgi-bin\test.fcgi"; 6. Open in Firefox the link "http://localhost/cgi-bin/test.fcgi"; And not works. When I open the link, Firefox freezes, as if the module was on infinity loop. How do I fix it? Thx.

Do not pull (all) your hair yet :)

I was testing FCGI with fpweb the past day or so on Windows, and it seems to be broken and only the FastCgiExternalServer way is working. In fact, you are correct that there is an infinite loop, and that is Apache trying to start up the FCGI application continuously at startup, but it keeps exiting. You can see it in the apache error logs.

On Linux, everything works OK for both mod_fastcgi (sources from fastcgi.com/dist) and mod_fcgid that the Apache project develops.

For now, I suggest you use the FastCgiExternalServer way on Windows and specify a port in your FCGI app/Apache conf. You need to start the FCGI application before sending the requests to it though because this way Apache does not do it for you.
In any case, this is the best way to develop and debug an FCGI application anyway because you can just use breakpoints and the debug facilities from within Lazarus.

It will be fixed on Windows as soon as the problem is found, I am sure. We are still trying to find the issue.

AB

Reply by email

silvioprog
to ABorka

2011/5/26 ABorka :
[...]

For now, I suggest you use the FastCgiExternalServer way on Windows and specify a port in your FCGI app/Apache conf. You need to start the FCGI application before sending the requests to it though because this way Apache does not do it for you.

Hm..., and how I do it? (is there any article?) :/

Thx AB.

AB
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

ABorka
to silvioprog
silvioprog wrote 10 lines
2011/5/26 ABorka: [...] > For now, I suggest you use the FastCgiExternalServer way on Windows and > specify a port in your FCGI app/Apache conf. You need to start the FCGI > application before sending the requests to it though because this way Apache > does not do it for you. Hm..., and how I do it? (is there any article?) :/ Thx AB.
1. Specify a port number in your project main file (.lpr)
...<snip>...
   Application.Title:='My FCGI Application';
   Application.Port:=2015;//Port the FCGI application is listening on
   Application.Initialize;
   Application.Run;
...<snip>...

2. In your apache config file (ex: httpd.conf) put something like LoadModule fastcgi_module "C:/path to the dll/mod_fastcgi-2.4.6-AP22.dll" <IfModule mod_fastcgi.c>
ScriptAlias /myfcgi "C:/path to your fcgi application/yourfcgi.exe" <Directory "C:/path to your fcgi application">
SetHandler fastcgi-script
Order allow,deny
Allow from all
</Directory>
FastCgiExternalServer "C:/path to your fcgi application/yourfcgi.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush
</IfModule>

Note, the port number in the .conf file and in your app must match

3. Restart your Apache
4. Start up your FCGI application in a command prompt window or from Lazarus if you want to run in debug mode
5. Open your web browser and go try to call your FCGI application (ex: http://127.0.0.1:8080/myfcgi/ActionName )

AB

Reply by email

silvioprog
to ABorka

2011/5/26 ABorka :

Show quoted text 30 lines
1. Specify a port number in your project main file (.lpr) ...<snip>... ?Application.Title:='My FCGI Application'; ?Application.Port:=2015;//Port the FCGI application is listening on ?Application.Initialize; ?Application.Run; ...<snip>... 2. In your apache config file (ex: httpd.conf) put something like LoadModule fastcgi_module "C:/path to the dll/mod_fastcgi-2.4.6-AP22.dll" <IfModule mod_fastcgi.c> ?ScriptAlias /myfcgi "C:/path to your fcgi application/yourfcgi.exe" ?<Directory "C:/path to your fcgi application"> ? ?SetHandler fastcgi-script ? ?Order allow,deny ? ?Allow from all ?</Directory> ?FastCgiExternalServer "C:/path to your fcgi application/yourfcgi.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush </IfModule> Note, the port number in the .conf file and in your app must match 3. Restart your Apache 4. Start up your FCGI application in a command prompt window or from Lazarus if you want to run in debug mode 5. Open your web browser and go try to call your FCGI application (ex: http://127.0.0.1:8080/myfcgi/ActionName ) AB

Yes, I followed all these steps, but error again.

My steps:

1. Stop Apache;
2. Download the "mod_fastcgi-2.4.6-AP22.dll" and copy to "C:\xampp\apache\modules";
3. Adds in the "C:\xampp\apache\conf\httpd.conf":
LoadModule fastcgi_module "C:/xampp/apache/modules/mod_fastcgi-2.4.6-AP22.dll" <IfModule mod_fastcgi.c>
ScriptAlias /myfcgi "C:/xampp/htdocs/fcgi/test.fcgi" <Directory "C:/xampp/htdocs/fcgi">
SetHandler fastcgi-script
Order allow,deny
Allow from all
</Directory>
FastCgiExternalServer "C:/xampp/htdocs/fcgi/test.fcgi" -host 127.0.0.1:2015 -idle-timeout 30 -flush
</IfModule>
4. Start Apache;
5. Open CMD, and run command "C:\xampp\htdocs\fcgi\test.fcgi";
6. Open the link "http://127.0.0.1:8080/fcgi/test.fcgi" (tested "http://127.0.0.1:2015/fcgi/test.fcgi" too, without success);

The result of steps above:
"Not found
The requested URL /fcgi/test.fcgi was not found on this server".

I send my new demo (source and .fcgi) here: http://www.sendspace.com/file/hk29na

My Apache is:

Apache Version Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o mod_fastcgi/2.4.6 PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1 Apache API Version 20051115
Hostname:Port localhost:80
Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts Connection: 300 - Keep-Alive: 5
Virtual Server No
Server Root C:/xampp/apache
Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_auth_digest mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav_lock mod_dir mod_env mod_headers mod_include mod_info mod_isapi mod_log_config mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_rewrite mod_setenvif mod_ssl mod_status mod_fastcgi mod_php5 mod_perl

AB, thanks for your step by step. :)

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Michael Van Canneyt
to silvioprog
silvioprog wrote 15 lines
1. Stop Apache; 2. Download the "mod_fastcgi-2.4.6-AP22.dll" and copy to "C:\xampp\apache\modules"; 3. Adds in the "C:\xampp\apache\conf\httpd.conf": LoadModule fastcgi_module "C:/xampp/apache/modules/mod_fastcgi-2.4.6-AP22.dll" <IfModule mod_fastcgi.c> ScriptAlias /myfcgi "C:/xampp/htdocs/fcgi/test.fcgi" <Directory "C:/xampp/htdocs/fcgi"> SetHandler fastcgi-script Order allow,deny Allow from all </Directory> FastCgiExternalServer "C:/xampp/htdocs/fcgi/test.fcgi" -host 127.0.0.1:2015 -idle-timeout 30 -flush

do not use SetHandler fastcgi-script, do not name the URL .fcgi.

Use a neutral name:

FastCgiExternalServer "C:/xampp/htdocs/fcgi/test" -host 127.0.0.1:2015 -idle-timeout 30 -flush

I found the error why mod_fcgid does not work, but it will not be easy to fix.

Michael.

Reply by email

ABorka
to silvioprog: 2011/5/26 ABorka : Yes, I followed all these steps, but error again. My steps: 1. Stop…
silvioprog wrote 82 lines
2011/5/26 ABorka: > 1. Specify a port number in your project main file (.lpr) > ...<snip>... > Application.Title:='My FCGI Application'; > Application.Port:=2015;//Port the FCGI application is listening on > Application.Initialize; > Application.Run; > ...<snip>... > > 2. In your apache config file (ex: httpd.conf) put something like > LoadModule fastcgi_module "C:/path to the dll/mod_fastcgi-2.4.6-AP22.dll" > <IfModule mod_fastcgi.c> > ScriptAlias /myfcgi "C:/path to your fcgi application/yourfcgi.exe" > <Directory "C:/path to your fcgi application"> > SetHandler fastcgi-script > Order allow,deny > Allow from all > </Directory> > FastCgiExternalServer "C:/path to your fcgi application/yourfcgi.exe" -host > 127.0.0.1:2015 -idle-timeout 30 -flush > </IfModule> > > Note, the port number in the .conf file and in your app must match > > 3. Restart your Apache > 4. Start up your FCGI application in a command prompt window or from Lazarus > if you want to run in debug mode > 5. Open your web browser and go try to call your FCGI application > (ex: http://127.0.0.1:8080/myfcgi/ActionName ) > > AB Yes, I followed all these steps, but error again. My steps: 1. Stop Apache; 2. Download the "mod_fastcgi-2.4.6-AP22.dll" and copy to "C:\xampp\apache\modules"; 3. Adds in the "C:\xampp\apache\conf\httpd.conf": LoadModule fastcgi_module "C:/xampp/apache/modules/mod_fastcgi-2.4.6-AP22.dll" <IfModule mod_fastcgi.c> ScriptAlias /myfcgi "C:/xampp/htdocs/fcgi/test.fcgi" <Directory "C:/xampp/htdocs/fcgi"> SetHandler fastcgi-script Order allow,deny Allow from all </Directory> FastCgiExternalServer "C:/xampp/htdocs/fcgi/test.fcgi" -host 127.0.0.1:2015 -idle-timeout 30 -flush </IfModule> 4. Start Apache; 5. Open CMD, and run command "C:\xampp\htdocs\fcgi\test.fcgi"; 6. Open the link "http://127.0.0.1:8080/fcgi/test.fcgi" (tested "http://127.0.0.1:2015/fcgi/test.fcgi" too, without success); The result of steps above: "Not found The requested URL /fcgi/test.fcgi was not found on this server". I send my new demo (source and .fcgi) here: http://www.sendspace.com/file/hk29na My Apache is: Apache Version Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o mod_fastcgi/2.4.6 PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1 Apache API Version 20051115 Hostname:Port localhost:80 Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts Connection: 300 - Keep-Alive: 5 Virtual Server No Server Root C:/xampp/apache Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_auth_digest mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav_lock mod_dir mod_env mod_headers mod_include mod_info mod_isapi mod_log_config mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_rewrite mod_setenvif mod_ssl mod_status mod_fastcgi mod_php5 mod_perl AB, thanks for your step by step. :)
Try

http://127.0.0.1:8080/myfcgi/index

instead, because that is why we did the ScriptAlias, so the calling URL is simpler.

AB

Reply by email

silvioprog
to ABorka

2011/5/26 ABorka :

Show quoted text 6 lines
Try http://127.0.0.1:8080/myfcgi/index instead, because that is why we did the ScriptAlias, so the calling URL is simpler.

Same error. x(

Please, see:

http://imagebin.org/155296

AB
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

silvioprog
to Marcos Douglas

2011/5/26 Marcos Douglas :

Show quoted text 5 lines
Use: /fcgi/test.exe not: /fcgi/test.fcgi

Same error. x(

I paused my AVG, but, same error.

Marcos Douglas
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

ABorka
to silvioprog: 2011/5/26 ABorka : Same error. x( Please, see: http://imagebin.org/155296 Silvio Cl?cio…
silvioprog wrote 14 lines
2011/5/26 ABorka: > Try > > http://127.0.0.1:8080/myfcgi/index > > instead, because that is why we did the ScriptAlias, so the calling URL is > simpler. Same error. x( Please, see: http://imagebin.org/155296

OK, here is what I did to make your downloaded project work (was not trivial):

1. Unzipped it and moved everything to the same directories
2. Edited the project main .lpr file and changed it to ...<snip>...
uses
fpFCGI, Unit1, iniwebsession {for the error message}, custfcgi {for the poStripContentLength};

begin
   Application.Port := 2015; //Port the FCGI application is listening on
   Application.ProtocolOptions := Application.ProtocolOptions +
[poStripContentLength];//on windows, without this the response can be
cut short
   Application.Initialize;
   Application.Run;
end.
...<snip>...

Note, without the iniwebsession we just get an exception complaining about it (this requirement should be removed from fpweb). Also, custfcgi is needed so we can add the protocolotions line, so on Windows the reply is not cut short by Apache (like error messages about the iniwebsession, for example).

3. in the httpd.conf
LoadModule fastcgi_module
"C:/xampp/apache/modules/mod_fastcgi-2.4.6-AP22.dll" <IfModule mod_fastcgi.c>
ScriptAlias /myfcgi "C:/xampp/htdocs/fcgi/test.exe" <Directory "C:/xampp/htdocs/fcgi">
Order allow,deny
Allow from all
</Directory>
FastCgiExternalServer "C:/xampp/htdocs/fcgi/test.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush

4. Start apache
5. Start the test.exe application from a cmd window
6. Navigate to http://127.0.0.1:8080/myfcgi/index from my browser to see: Test

Note, your response generation only sends back the text "Test" instead of a proper web page. It should be at least something like

   Handled := True;
   AResponse.Content := '<html><body>Test</body></html>';

AB

Reply by email

silvioprog
to ABorka

2011/5/26 ABorka :

Show quoted text 48 lines
OK, here is what I did to make your downloaded project work (was not trivial): 1. Unzipped it and moved everything to the same directories 2. Edited the project main .lpr file and changed it to ...<snip>... uses ?fpFCGI, Unit1, iniwebsession {for the error message}, custfcgi {for the poStripContentLength}; begin ?Application.Port := 2015; //Port the FCGI application is listening on ?Application.ProtocolOptions := Application.ProtocolOptions + [poStripContentLength];//on windows, without this the response can be cut short ?Application.Initialize; ?Application.Run; end. ...<snip>... Note, without the iniwebsession we just get an exception complaining about it (this requirement should be removed from fpweb). Also, custfcgi is needed so we can add the protocolotions line, so on Windows the reply is not cut short by Apache (like error messages about the iniwebsession, for example). 3. in the httpd.conf LoadModule fastcgi_module "C:/xampp/apache/modules/mod_fastcgi-2.4.6-AP22.dll" <IfModule mod_fastcgi.c> ?ScriptAlias /myfcgi "C:/xampp/htdocs/fcgi/test.exe" ?<Directory "C:/xampp/htdocs/fcgi"> ? ?Order allow,deny ? ?Allow from all ?</Directory> ?FastCgiExternalServer "C:/xampp/htdocs/fcgi/test.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush 4. Start apache 5. Start the test.exe application from a cmd window 6. Navigate to http://127.0.0.1:8080/myfcgi/index from my browser to see: Test Note, your response generation only sends back the text "Test" instead of a proper web page. It should be at least something like ?Handled := True; ?AResponse.Content := '<html><body>Test</body></html>';

Oh, same error again. :S

http://imagebin.org/155410

Another error:

"Unit1.pas(1,1) Fatal: Can't find unit iniwebsession used by fcgiproject1".

I looked in every folder of Lazarus and did not find this unit. :(

My environment:

Lazarus 0.9.31 r30896 FPC 2.5.1 i386-win32-win32/win64 Windows: http://imagebin.org/155412

Thanks.

AB
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Unknown author
to silvioprog
silvioprog wrote 13 lines
> > 4. Start apache > 5. Start the test.exe application from a cmd window > 6. Navigate to http://127.0.0.1:8080/myfcgi/index from my browser to see: > Test > > Note, your response generation only sends back the text "Test" instead of a > proper web page. It should be at least something like > > ?Handled := True; > ?AResponse.Content := '<html><body>Test</body></html>'; Oh, same error again. :S

The above configuration is quite complicated, you are mixing several things. It can be done much more simple. All you need is the FastCgiExternalServer directive.

<IfModule mod_fastcgi.c>
# The following assumes that the C:/xampp/htdocs/ directory is DocumentRoot. <Directory "C:/xampp/htdocs/fcgi">
Options +ExecCGI
? ?Order allow,deny
? ?Allow from all
?</Directory>
?FastCgiExternalServer "C:/xampp/htdocs/fcgi/mytest" -host 127.0.0.1:2015 -idle-timeout 30 -flush </ifmodule>

And then the URL
http://127.0.0.1:8080/fcgi/mytest

should work.

Michael.

Reply by email

silvioprog
to Unknown author

2011/5/27 :

Show quoted text 21 lines
The above configuration is quite complicated, ?you are mixing several things. It can be done much more simple. All you need is the FastCgiExternalServer directive. ?<IfModule mod_fastcgi.c> ?# The following assumes that the C:/xampp/htdocs/ directory is DocumentRoot. ?<Directory "C:/xampp/htdocs/fcgi"> ? ? ?Options +ExecCGI ? ? ?Order allow,deny ?? ? ?Allow from all ??</Directory> ??FastCgiExternalServer "C:/xampp/htdocs/fcgi/mytest" -host 127.0.0.1:2015 -idle-timeout 30 -flush ?</ifmodule> And then the URL ?http://127.0.0.1:8080/fcgi/mytest should work.

YYYYYYYEEEEEEEeeeeeeehhhhhhh!!!!!!! <|:}D WORKED!

But...

I followed steps of AB and steps above, and open the link without 8080 ...:

http://127.0.0.1/fcgi/mytest

...then:

<html><body>Test</body></html>

I love FPC-Lazarus forever!

Thanks again Lee Jenkins, ABorka, Michael, Marcos and All.

Michael.
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Unknown author
to silvioprog
silvioprog wrote 20 lines
2011/5/27 : > > And then the URL > ?http://127.0.0.1:8080/fcgi/mytest > > should work. YYYYYYYEEEEEEEeeeeeeehhhhhhh!!!!!!! <|:}D WORKED! But... I followed steps of AB and steps above, and open the link without 8080 ...: http://127.0.0.1/fcgi/mytest ...then: <html><body>Test</body></html> I love FPC-Lazarus forever!

It gets even better.

With revision 17569, all standard FastCGI functionality now also works on Windows. (no more need for FastCGIExternalServer)

Both FastCGI modules (mod_fcid and mod_fastcgi) are now supported on all platforms.

Michael.

Reply by email