RTC Forums
November 24, 2024, 05:48:40 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: PHP Need help  (Read 5681 times)
inl
RTC License++
*****
Posts: 12


« on: December 16, 2012, 08:41:01 AM »

Hello Danijel,

with your RTC_WebServer-Demo and installed PHP 5.2.17 the response of php-files/script is allways an empty page!

What went wrong?
Here are the logs:

2012-12-16 08:35:23.214; Read LOG "C:\Komponenten\RealThinClientSDK_v605_2012Q4\Demos\RTC_WebServer\RTCWebServer.ini"
2012-12-16 08:35:28.386; Read LOG "C:\Komponenten\RealThinClientSDK_v605_2012Q4\Demos\RTC_WebServer\RTCWebServer.ini"
2012-12-16 08:35:28.418; SERVER STARTED on Port 80 ...
2012-12-16 08:35:28.449; PHP Ready.
2012-12-16 08:36:39.795; ++++ 127.0.0.1:2953 [0 open]
2012-12-16 08:36:39.795; SEND 127.0.0.1 > localhost "GET /phpinfo.php" 0 REF "" AGENT "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)" > 0 ms


2012-12-16 08:36:39.795; Exec localhost > /phpinfo.php
Accept: */*
Accept-Language: de
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)
Accept-Encoding: gzip, deflate
Host: localhost
Connection: Keep-Alive
COOKIE: rtc_forum_uid=BBKN9%2BK0KzZB4PqtdcKbvOGaeRwqbamIMPT4
COOKIE >> (Delimiter=&)
1. "rtc_forum_uid" = <BBKN9%2BK0KzZB4PqtdcKbvOGaeRwqbamIMPT4>

2012-12-16 08:36:39.795; Done localhost > /phpinfo.php > 0 ms
X-Powered-By: PHP/5.2.17
Content-type: text/html

Can you give a little help?

Thanks
Bernd
 
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: December 16, 2012, 09:21:09 AM »

1. Which Delphi version are you using to compile the Project?

2. Is the compiler directive PHP520 defined (PHP530 has to be undefined)?

3. Are you compiling for the Win32 target platform?

PS. There is no official support for using PHP with the RTC SDK (there never was). The PHP implementation provided in the RTC SDK is several years old and it isn't actively maintained.

Best Regards,
Danijel Tkalcec
Logged
inl
RTC License++
*****
Posts: 12


« Reply #2 on: December 16, 2012, 09:28:51 AM »

Hello Danijel,

i am working with Delphi 7 and the directives PHP5 and PHP520 are set over rtcDefs.inc.
Testing Environment is 32bit (Windows XP Prof.)

Best regards
Bernd
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: December 16, 2012, 12:05:39 PM »

After trying to get the PHP interface to "behave", I will have to strongly recommend against using it.

There seem to be problems with automatic memory allocation and deallocation of data which needs to be shared between Delphi and the PHP DLL. This manifests in loss of data (like the response content not being returned correctly from the TRtcPHP.Execute method) and unpredictable Access Violations, which usually means that a memory block is still being accessed after it has been released.

Even though I did manage to get the phpinfo page to display its content, the PHP logo was often missing and there were occasional Access Violations in some weird locations, even with the Server running in single-threaded mode, which suggests that there is something seriously wrong with the interface to the PHP DLL.

If you need to host PHP content, I recommend using the latest PHP version with one of the officially supported PHP Servers. If you want to combine PHP with RTC, take a look at RTC Router and Load Balancer Projects.

Best Regards,
Danijel Tkalcec
Logged
inl
RTC License++
*****
Posts: 12


« Reply #4 on: December 16, 2012, 08:34:09 PM »


Thank you for your fast reply,

as well this was actually not the answer i want to hear...

Yes, I want to combine PHP with RTC. How do you think RTC Router / Load Balancer can help me to resove my problem?

Thanks
Bernd
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #5 on: December 16, 2012, 09:21:05 PM »

You won't get PHP running from Delphi or by using the RTC SDK, but you can use a Router or a Load Balancer to make content coming from multiple different Servers accessible through a single Address and Port.

Here is an example:

1. Install Apache or some other PHP-compatible Web Server on a custom Port (like 8080) and host your PHP content there.

2. Install your RTC Server to host your Delphi content on another custom Port (like 8081).

3. Install a Router or Load Balancer on Port 80 and configure it to forward PHP-related requests to the Apache Server (port 8080), and all the other requests to your RTC Server (port 8081). Using a Load Balancer would probably be easier that a Router, because there is an example RTC Load Balancer Project which already provides all the functionality you need. It just has to be configured.

Alternatively, instead of using one Project for the Load Balancer and another one for your RTC Server, you could also attach your RTC Server content to run directly from the Load Balancer Project. But having a separate process might be a cleaner solution in this case, because you will be able to replace your Delphi content without losing access to PHP stuff - because the Load Balancer won't have to be restarted if it is running separately.

Naturally, if all you want is a way to host PHP content, then there is no need for a RTC Server, Router or Load Balancer. The example above only makes sense if you want to make "Delphi pages" accessible together with "PHP pages" (or even ASP.NET) from a single Server (Load Balancer) Port and Address.

There is also a third option to make PHP and Delphi code accessible from a single Server and Port. It would not require the use of a Router or a Load Balancer. You could also compile your RTC Server-side code into an ISAPI DLL, then make your ISAPI DLL hosted by the Apache Server alongside your PHP code.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.025 seconds with 16 queries.