RTC Forums

Subscription => Support => Topic started by: xdu2050 on January 28, 2017, 10:59:16 AM



Title: Can update rtcPHPTypes for php7?
Post by: xdu2050 on January 28, 2017, 10:59:16 AM
Can update rtcPHPTypes for php7?


Title: Re: Can update rtcPHPTypes for php7?
Post by: D.Tkalcec (RTC) on January 28, 2017, 11:45:23 AM
"rtcPHPTypes" unit (which is included in the Demos/DataProviders folder), was an experiment to see if one could write a "DataProvider" to run Scripts from a multi-threaded RTC Server by using an external 3rd-party library.

If you look at the top of the "rtcPHPTypes" unit, you will see this text:

NOTE: This unit and PHP support from RTC is purely experimental.
You should NOT use this code in a productive environment!


I chose PHP only because there was an Open Source library called "php4Delphi", which had support for linking with the PHP library and running PHP 4 and PHP 5 scripts, but I've had to modify the original "php4Delphi" code in a few places to get it working from a multi-threaded RTC Server, because the library wasn't thread-safe. It did seem to work with PHP 4.0 and 5.0.3, but ...

Because (1) the "php4Delphi" library was last updated by its original developer in 2009, (2) the developers behing PHP keep changing interfaces and structure definitions in their PHP DLL which would need to be updated for "php4Delphi" to work with each PHP version, chances of this "experiment" being continued or reaching the necessary level of maturity required to make it ready for use in productive environments are equal to zero.

If you have already implemented PHP projects which you wanted to host using a RTC Server and you need support for PHP7, you can try to find a more recent version of "php4Delphi" and/or check if you can update the "rtcPHPTypes" unit yourself to get it working reliably in a multi-threaded environment.

As an alternative, in case you plan on starting a new Project in Delphi and you want to use a scripting engine, but it does NOT have to be PHP, I highly recommend the included RTC Scripting Engine, which gives you the power to directly call your own Delphi code from scripts written in a pascal-like scripting language. It's very similar to having your own compiler with full source code in Delphi and a set of functions you can design to best suit your own requirements. It gives you all the positive effects of using a scripting language with the power of natively compiled code where performance is required with access to everything Delphi has to offer.

Check the "QuickStart/rtcScript" folder for an example of using the RTC Scripting Engine. Alternatively, if you want to compeltely separate your code from design, you can use the RTC Parser, for which you can find simple examples in the "QuickStart/rtcParse1-3" folders.

Best Regards,
Danijel Tkalcec


Title: Re: Can update rtcPHPTypes for php7?
Post by: xdu2050 on January 29, 2017, 05:37:03 AM
Tks