Forum > Networking and Web Programming
Getting Started
acolburn:
I have a small app I wrote with FPC/Lazarus, trying hard to keep the GUI code separate from everything else. It cross compiles well on a PC and Mac. Now I'd like to try to make a web based version, still using Pascal.
But I am an absolute newbie at this; I have self-studied Pascal for awhile and briefly explored PHP and Python for the web. I'm also OK with HTML/CSS. I have seen the fpWeb tutorial at the top of this thread, as well as Leledumbo's (2015) tutorial. They are both clear and bookmarked. However, I would be grateful for an even more basic tutorial.
Also, with Python and PHP it was pretty easy to just upload files to my web host; the interpreters were present, configured, and running. Are there any hosts doing the same thing for FPC or do I have to learn how to setup, configure, and run my own server?!
Thanks, as always -- Al
Phil:
Al,
If you've kept the non-UI part of your program separate (ie, does not use any LCL units), you should be able to put that into a Pascal server app, or a Pascal dynamic library that can be used with a non-Pascal server app.
You might take a look at this. I've had good luck with this approach:
https://dl.dropboxusercontent.com/u/28343282/MacXPlatform/WebAppOverview.html
As for a server, see Part 4 of this article series. It's not hard to set up a Windows or Linux server and the first year of AWS is free:
https://dl.dropboxusercontent.com/u/28343282/MacXPlatform/PascalDynLibs.html
Feel free to ask questions about any of this. Quite a bit there.
-Phil
Leledumbo:
--- Quote from: acolburn on July 20, 2016, 05:17:06 pm ---I have seen the fpWeb tutorial at the top of this thread, as well as Leledumbo's (2015) tutorial. They are both clear and bookmarked. However, I would be grateful for an even more basic tutorial.
--- End quote ---
Define "more basic". If it contradicts with the preface of my tutorial, sorry but no. I don't want to clutter it with basic HTTP protocol flow, specific web server configuration, etc. Their respective documentation is already huge enough.
--- Quote from: acolburn on July 20, 2016, 05:17:06 pm ---Also, with Python and PHP it was pretty easy to just upload files to my web host; the interpreters were present, configured, and running. Are there any hosts doing the same thing for FPC or do I have to learn how to setup, configure, and run my own server?!
--- End quote ---
Depends on what protocol and how you want to deploy. CGI is typically just drop in (unless the web server doesn't support or is not configured to support, as many web hosting services do), FastCGI has several ways (manual separate instance maintenance to autospawning multiple instance), embedded server only needs proxy if you want to access it by name, apache module requires apache (for sure) and the ability to modify its configuration file.
acolburn:
My thanks to both of you for replying. Your text is clear Phil. As you say, there's quite a bit there. And, Leldumbo, I wasn't posting with the hope you would change your tutorial. It's nice you did it at all, for free; I would never be critical. ... It's just difficult for me to find resources that fit my background. There's a gap between understanding variables and loops, basic OOP, etc. and the more advanced concepts needed for many real world applications, esp. if one likes Pascal:)
Phil:
I would suggest just getting a real server that you can install and configure as you want and start playing around with it. No better way to learn about this stuff. And you can't beat free.
To see how much you're saving and how much AWS would cost you after the first year, use Amazon's calculator:
https://calculator.s3.amazonaws.com/index.html
- Select a region. For example, US-East.
- Add an instance, then select a t2-micro with Windows or Linux. The t2-micro is free for 12 months.
- Add 30 GB of SSD storage. This is also free for 12 months.
I see $13.18/mo for Windows and $9.52/mo for Linux. But the total at the top should say $0.00 since this configuration qualifies for the free tier.
I use Windows since it works so well from my Mac via MS's Remote Desktop app. Like having Windows in a window on my desktop.
This is a pretty fast server too. Xeon E5-2670 @ 2.5 GHz. And the SSD storage really makes it go. You can even use this as a general-purpose machine. FPC and Lazarus work fine.
-Phil
Navigation
[0] Message Index
[#] Next page