Re: [Lazarus] Developing with fcl-web

2014-07-29 Thread Michael Schnell

On 07/28/2014 05:28 PM, Michael Van Canneyt wrote:

Well, yes. Why are you repeating what 2 people already replied ?

???

You did mention TCP/IP via port 10020, but you also stated if you use 
mod_fastcgi.so. I tired to offer that this might not only possible with 
a .so (linked object to be started by Apache and hence creating the 
debugging attach problem in question) but also with a stand alone 
executable, started by the debugger.


-Michael (just trying to be helpful)

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-29 Thread Michael Van Canneyt



On Tue, 29 Jul 2014, Michael Schnell wrote:


On 07/28/2014 05:28 PM, Michael Van Canneyt wrote:

Well, yes. Why are you repeating what 2 people already replied ?

???

You did mention TCP/IP via port 10020, but you also stated if you use 
mod_fastcgi.so. I tired to offer that this might not only possible with a 
.so (linked object to be started by Apache and hence creating the debugging 
attach problem in question) but also with a stand alone executable, started 
by the debugger.


Then IMHO you have not understood how fastcgi works.

Fastcgi always works with a stand-alone executable.

mod_fastcgi.so is not a FPC module, but an apache module that implements FastCGI support for Apache. 
It has nothing to do with FPC. There is also mod_fcgid.so, which does the same, but which insists on 
starting the fastcgi binary by itself. The latter is not suitable for debugging the executable.


Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-29 Thread Michael Schnell

On 07/29/2014 01:47 PM, Michael Van Canneyt wrote:

...

Thanks for the clarification.

-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-28 Thread Michael Schnell

On 07/26/2014 02:47 PM, Michael Van Canneyt wrote:

2. You can run the fastcgi server ...


AFAIK, the fastCGI specification allows for having the WebServer and the 
CGI communicate via TCP/IP. In this case the CGI is not necessarily 
started by the WebServer but can be a permanently running executable and 
even reside on a different machine. Here a normal debugging should be 
possible as well.


-Michael


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-28 Thread Michael Van Canneyt



On Mon, 28 Jul 2014, Michael Schnell wrote:


On 07/26/2014 02:47 PM, Michael Van Canneyt wrote:

2. You can run the fastcgi server ...


AFAIK, the fastCGI specification allows for having the WebServer and the CGI 
communicate via TCP/IP. In this case the CGI is not necessarily started by 
the WebServer but can be a permanently running executable and even reside on 
a different machine. Here a normal debugging should be possible as well.


Well, yes. Why are you repeating what 2 people already replied ?

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-28 Thread Reinier Olislagers
On 28/07/2014 17:28, Michael Van Canneyt wrote:
 
 
 On Mon, 28 Jul 2014, Michael Schnell wrote:
 
 On 07/26/2014 02:47 PM, Michael Van Canneyt wrote:
 2. You can run the fastcgi server ...

 AFAIK, the fastCGI specification allows for having the WebServer and
 the CGI communicate via TCP/IP. In this case the CGI is not
 necessarily started by the WebServer but can be a permanently running
 executable and even reside on a different machine. Here a normal
 debugging should be possible as well.
 
 Well, yes. Why are you repeating what 2 people already replied ?
 

Because he's good at sending but not receiving.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread ABorka

There is some information on what Michael mentions below here:

http://forum.lazarus.freepascal.org/index.php/topic,13312.15.html

It might help a little. The linked post has some explanation on the 
different (3 ways) FCGI solutions with apache and fpc/lazarus.


AB

On 7/26/2014 05:47, Michael Van Canneyt wrote:



On Sat, 26 Jul 2014, Reimar Grabowski wrote:


Hi,

first of all, sorry if the information is out there, but I did not
find anything usefull to help me along.

I need to build a server-side application (fcgi is my choice) that
gets send some json, processes it and communicates with a mysql
database, simple enough.
Looks like all this is perfectly doable without any problems with
Lazarus and fcl-web, at least the 'gets send some json and processes
it'-part I have already done for another project.
But it was a pain to develop.
For such kind of projects I am used to Java and development in Eclipse.
My major problem with Lazarus is where is my server?


That depends.


In Eclipse I just configure my Tomcat or whatever other container I
want to use, press 'run on server' and voila, eclipse starts Tomcat
and my application with full logging working inside the IDE to be
found at 'http://localhost:8080/myapp'.
If I need breakpoints or single stepping, I just start the server in
debug mode and all is well.
So how do I configure Lazarus to do about the same?


It depends on how you set it up.


I found some mentioning of fpembweb or lazaruswebdesign packages but
nothing concrete about where to find or how to use them.
Surely some of you guys do such kind of development with Lazarus and I
cannot believe that everybody runs a local apache and copies his
executable around after every compile (my apache is on a VM which made
it even more work to copy the files around and there was no debugging
capability to speak of).
So it boils down to let Lazarus run the fcgi app (can be another app
type if it is easy to switch it to fcgi for deployment) on an
(embedded) server, with logging output shown in the IDE and the option
to use a debugger with breakpoints and single stepping.


There are 2 options:

1. Use embedded server to do the debugging; that part is easy, it's like
running a normal executable.
You don't need apache for this.

2. You can run the fastcgi server if you use mod_fastcgi.so, but then
you must use the ExternalFastCGIServer option, and configure the fastcgi
application to listen on this port:

In Apache, configure
FastCgiExternalServer /home/michael/public_html/testht -host
127.0.0.1:10020 -idle-timeout 3 -flush
Here 10020 is the port to listen on, and
/home/michael/public_html/testht is the URL that will be the 'base' url
for your fastcgi app.


In that case, your fastcgi application must be configured to listen on
the same port:
Set
Application.Port:=10020;
in the project source file.

Restart apache, run your executable, and do a request through the
browser. That's it.

Note that you cannot do this with the mod_fcgid module. I do believe
that in Apache 2.4, mod_proxy can handle this situation, but I haven't
tried yet.

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread leledumbo
 My major problem with Lazarus is where is my server? 
 So how do I configure Lazarus to do about the same? 

Up to you. Apache, nginx, any other you've ever heard of, fphttpserver
(embedded), the choice is yours. The last is capable of debugging from IDE.
If you use the Lazarus wizard, you should've found it in the application
type selection dialog. But actually they only differ in uses clause (fpcgi,
fpfcgi, fphttpapp), everything else is the same. Well, maybe you need to set
Port as well but that's all. Practically this applies to ALL fcl-web
examples, so you can try it yourself.



--
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Developing-with-fcl-web-tp4038075p4038085.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread Reimar Grabowski
On Sat, 26 Jul 2014 14:47:07 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:

 There are 2 options:
 
 1. Use embedded server to do the debugging; that part is easy, it's like 
 running a normal executable.
 You don't need apache for this.

That's what I am looking for. The 'use embedded server' part is what I failed 
to understand how to do. But leledumbos mail (hopefully) cleared things up. I 
was expecting the server, to be started by Lazarus and not that it is a 
different option in the 'New Project' wizard.
 
 2. You can run the fastcgi server if you use mod_fastcgi.so, but then you 
 must use the ExternalFastCGIServer option, and configure the fastcgi 
 application to listen on this port:

Although this is not what I am currently looking for, it's appreciated for 
future reference.
It's always good to have options.

Thanks.
R.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread leledumbo
 I tried this on my older CGI Application, changing the uses clause in the
.lpr file to 'fphttpapp'. Compiled without a problem but of course I could
not run it in Lazarus since the run button/menu entry is disabled.

Check Project Options-Miscellanous-Project Is Runnable. CGI wizard
automatically uncheck this because it makes no sense for CGI.

 Running on the command line gave a socket error which looks like it is
 working (perhaps changing the port from 80 to something else fixes this).

I don't remember whether the default is 80 or not, I always set it
explicitly via Application.Port.

 If it's that simple why is it that hard to get that information. Please,
 tell me I am stupid and there is a wiki page that I just did not find.

Perhaps it's your turn to contribute to fcl-web wiki article :)

P.S.: If you use Nginx or any other web server whose FastCGI executable must
be started manually, you can also debug from IDE



--
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Developing-with-fcl-web-tp4038075p4038088.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread Reimar Grabowski
On Sat, 26 Jul 2014 14:45:15 -0700 (PDT)
leledumbo leledumbo_c...@yahoo.co.id wrote:

 Perhaps it's your turn to contribute to fcl-web wiki article :)
Added to todo list.

R.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus