#1 2017-08-28 15:07:21

twdlewis
Member
Registered: 2017-08-28
Posts: 6

Newbie. How/can generate then call php/cfm pages?

Hello, I am new to web application servers, and mORMot.

Perhaps I am on the wrong track but via the Controller (i.e. in MVC) mechanism can I intercept url's to then generate php and cfm (coldfusion) files on the fly, then call them instead?

This is for working with existing code bases as needed in several forseeable scenarios.

Thank you.

Last edited by twdlewis (2017-08-28 15:41:14)

Offline

#2 2017-08-28 16:25:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Newbie. How/can generate then call php/cfm pages?

What you can do easily is redirect to an existing PHP or CFM local server.
Executing in the same process some php or cfm engine may be difficult to do, error-prone and unstable.

For redirection, make your own rooting
- either at the REST server level, adding some method-based service doing the remote request and URI redirection
- or at the HTTP server level adding a specific REST server with the corresponding method-based service

Offline

#3 2017-08-28 16:32:54

twdlewis
Member
Registered: 2017-08-28
Posts: 6

Re: Newbie. How/can generate then call php/cfm pages?

I have been reading the documentation for many hours. It looks like an awesome piece of software.

Thanks.

Offline

#4 2019-07-01 09:33:14

twdlewis
Member
Registered: 2017-08-28
Posts: 6

Re: Newbie. How/can generate then call php/cfm pages?

Hello, looking at this again now. Ready to proceed with projects and still not sure about this technology. Refining the question above:

By using the mormot code I will be able to create REST API's that handle various components of my program - calculators, database actions - and then install the exe on the private hosted php server. Web pages (mainly via php/jquery) can then call the api?

I am getting a little confused with how this fits in with having to publish compiled php extensions which I think I can do with Delphi and would also want to do. Thus, can the mormot application be able to communicate with such extensions, or do they need to just be compiled in to the exe. My concern then is what happens when multiple users are accessing at the same time.

I have also been looking at Phalcon but I have a lot of Delphi back end code I'd like to get access to online.

Thank you. Sorry, I am just getting back into programming after a long break and having trouble wrapping my head around this. Mormot is such a big project that it would be disastrous to find out after several months of learning it that it was the wrong platform.

Last edited by twdlewis (2019-07-01 09:36:16)

Offline

#5 2019-07-01 14:08:50

macfly
Member
From: Brasil
Registered: 2016-08-20
Posts: 374

Re: Newbie. How/can generate then call php/cfm pages?

Phalcon is just a framework, similar to Zend.

With Phalcon  You will program "scripts" in PHP just as you would any other framework.
The difference of phalcom is that framwork itself is an extension of PHP, but this does not change the way of programming for the developer.

If you need to generate "binaries", for maximum performance, code security, typing, etc. then the path would be Zephir, which translates from PHP to PHP extensions.

-------------

I believe that trying to integrate PHP into your Delphi / FPC application is not the way.

The natural way is to publish your Delphi / FPC application as a microservice, which can be consumed by PHP or Ajax clients (jquery) via uri (Rest).

For example, your Delphi/FPC application will be running on the server in the URI http://127.0.0.1:4000

And PHP can make a call to this address via CURL. In other words, it consumes the Rest service published by the Delphi / FPC application.

The same is true for an Ajax client:
$ .getJSON (the_microservive_url);

NOTE: In this case the microservice should have public access. The ideal would be to use a reverse for this.

-------------

Note that in this case PHP will act as a "proxy". The PHP script receives the request and then calls the microservice via CURL.
If you do not need to process the data via PHP will have better performance already make the request directly in the microservice, thus eliminating PHP from the equation.

-------------

Another option would be for you to publish the application as a Dll and PHP would use it.
I've done this a long time ago, but today I have no idea what the performance of this solution would be like, and how would data sharing, security, etc. be.

Offline

#6 2019-07-02 07:17:41

twdlewis
Member
Registered: 2017-08-28
Posts: 6

Re: Newbie. How/can generate then call php/cfm pages?

Thank you, I am trying to absorb that information. I think I will have to budget quite a lot of testing time for the various options.

Offline

#7 2019-07-03 09:27:48

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 211

Re: Newbie. How/can generate then call php/cfm pages?

Just curious, why do you think you need PHP at all?

Offline

#8 2019-07-04 00:51:07

twdlewis
Member
Registered: 2017-08-28
Posts: 6

Re: Newbie. How/can generate then call php/cfm pages?

I'm wanting to generate websites that use core functionality provided by the api.

Offline

#9 2019-07-12 04:24:54

twdlewis
Member
Registered: 2017-08-28
Posts: 6

Re: Newbie. How/can generate then call php/cfm pages?

Ok, perhaps I have misconceived the need for php.

So, my understanding now is that I can create a server with mormot and delphi/FPC that has already compiled into it, in (pascal), all the API functionality that I need?

And lots of users can access that code (eg a cpu-intensive calculator that in a desktop application I know can take up to 20 seconds to execute in a worst case) concurrently, without clashing or worrying too much about how large in Mb all that functionality compiles to? I don't need to put that code in a separate program/extension/php source etc?

I've been looking at node.js/express but am starting to doubt the advantages of that.

Thanks

Offline

#10 2019-07-12 07:49:59

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 211

Re: Newbie. How/can generate then call php/cfm pages?

twdlewis wrote:

Ok,
So, my understanding now is that I can create a server with mormot and delphi/FPC that has already compiled into it, in (pascal), all the API functionality that I need?


That's correct.

Last edited by pvn0 (2019-07-12 07:50:41)

Offline

Board footer

Powered by FluxBB