Jump to content
Hans-Wolfgang

Delphi LAMP- or WAMP-based Web Application

Recommended Posts

Recently I posted a question about creating a web application to display photos on a web site.

 

Reply came back, 'Don't build; use LAMP or WAMP instead'.

 

Could one of you please point me to resource(s) that implement(s) LAMP or WAMP algorithms/code to accomplish my task.

 

Best,

 

jwc

Share this post


Link to post

LAMP means an environment: Linux, Apache, MySql, and Php. WAMP means Windows, Apache, MySql, Php. 
The reply says: Don't use Delphi for that, use Apache, Linux, mySql and Php

Share this post


Link to post

As mentioned above, the reply meant 'Use PHP'.

 

The Delphi Web Server Application works pretty well but there are some influential factors e.g. having total control over the hosting environment. Usually those environment do offer the LAMP stack. There have been many attempts to host FAST-CGI server these days mostly written in FPC/Lazarus but from the hosting perspective PHP still rules and PHP engine handles the DB session management for you in a transparent fashion and not just this, what you would have implement on your own. Even if you implemented all the greatness the question remain, where to put all the stuff.

 

Assuming you have full control over the hosting environment a web application is pretty different since the way a web application is treated by the server and the browser is pretty different from structuring an application via the hierarchic model introduced with the help of modules in general. The only exceptions, not even that pays, would be a 1:1 mapping of Screens to  'web-screens' or web pages that reflect a 1:1 or 1:m relationship of database tables or results taken from a data-service provided on your own implemented in Delphi technology, not talking about web-services and such things.

 

Think of a  'main' web-module hosted in the web-server that is loading other modules ins fashion of a DLL or shared library on demand. All the goodness you implement would very likely be hosted this 'main' web-module that it plugged right into the web server. Anything else leads to a big module that contains everything. In comparison to a script based 'application' the module has to be unloaded or the web-server instance shut-down.

 

In case of an Intranet-application feel free to give a Delphi Web Server Application a try. Take care of the 'Debug Spawned Processes' under Options -Debugger Options - Embarcadero Debuggers. In order to get an impression simply try and don't forget to host the web-module integrated before debugging (Run - Load Process). In worst case simply attach to a running instance. If you like it should still be possible to use the Abyss webs-erver again but therefore remove the Line that enables multi-threading in the program file of the ISAPI.dll, if I remember correctly. Under IIS or IIS-Express you can leave it unchanged.

 

I don't have the source code at hand at the moment.

 

Of course feel free to implement a Delphi Web Server Application and deploy a DLL to ISS or an Apache Module simply use any of the samples on the Internet. You will have to gain a deep understanding of the web-technologies pretty similar to getting to know Windows programming in order to provide something beyond that just works great for you. There are good applications put to the web server that did benefit a long time from being offered better floating point performance compared to PHP which was pretty similar to most web languages great at handling strings in a 'fast' way. The moment you had to add something to the PHP environment that relied on C/C++ code beyond the Delphi option started to gain ground also from the perspective mentioned in the first paragraph, ok, the second concerning hosting driven influential factors. For example presenting interactive CAD drawings can make sense, a few nice pictures and that's it won't pay that much.

 

If you already gained a deep understanding of web-development already before, you would very likely not have asked, except you are forced to write an add-on module for an application. From the aforementioned perspective that overall effort can stay limited.

 

I personally used Delphi web technology to retrieve structured data and built web-services like data modules a few years ago, at the time before JSON hyped and put the service behind a service-proxy in order to treat the various requirements concerning data presentation.

 

If you start from scratch use PHP or Instant-FPC which combines the best of both worlds scripting as well as complied executables. In practice both alternatives will look pretty much the same, the moment the focus of the pages move a away from definitely a solid application put to the Intranet to strongly document oriented web pages/sites.

 

As always on the web, 'it depends' and if you don't know the answer before, use PHP. That's very likely the simple reason why people advised you to give a LAMP or WAMP stack a try.

 

Assuming you are hungry for implementing session management towards the data-base, alternatively use data modules Using Data Modules, I doubt you don't think of using CGI still, btw. I do, and  you can rely on solid Delphi knowledge, simply start a module based Delphi Web Server Application and anything else is plain Request/Response. The web broker handles most of the communication. You won't get far beyond ASP & friends or Request/Response.

 

There are many other options for using Delphi together with things built on top or replacing web-broker technology, but discussing those won't help, since they are all pretty good at what they are designed for.

Share this post


Link to post
Guest

A good example of what is the best use for Delphi in this context are the various "Lessons" you can find at https://rtc.teppi.net/.

Do a walk-through and you will realize that all the chromy-goody-inticate-javascript-thingies that "WordPress" and similar services has "out of the box" is hell to implement in Delphi (because no one is maintaining a big social network framework for Delphi, and why should we? It's on the JS side most of that).

Delphi is super-good, but since the world now has something out-of-the-box for your needs, i will too recommend you to have a look at these things first.

If you want to "tinker" with Delphi code, go ahead!!! You can do anything using Delphi. For sure.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×