Linux MySQL Connection


I need some advice please on the best way to proceed. I want to use Web Core to develop a web app that accesses a MySQL dataabase on a Linux web server.

The problem is that I cannot create an XData server to access it as I only have Delphi Pro.

What are my options?



Afaik, there is no limitation to use TMS XData with Delphi Pro, so this approach should work.

I'm confused. How do I create a xdata linux server then?

Ah, sorry, I missed the lack of Linux compiler in the Pro version. This is indeed problematic.
There are a couple of options mentioned here:

There is not a lot of data involved so I thought that I would try using a TWebHTTPRequest calling PHP on the server but I can't get this to work. I am getting the following errors in the console:

Source map error: request failed with status 404
unreachable code after return statement

Is there an example anywhere of calling php?

A 404 error would indicate the used URL is incorrect.

Ok, When I run it on the server it works ok but have another problem. The php is:

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST");
header("Access-Control-Allow-Headers: X-Requested-With");
$data = [ 'a', 'b', 'c' ];
echo json_encode($data); 

And when I just use firefox to access the php it displays:


But when I execute the TWebHTPRequest I get the content of the main page of my website returned.

What am I doing wrong?

Do you use the exact same URL?

Maybe you need to add a header for content type:

I'm afraid that made no difference. And yes, I copied and pasted the URL.

Maybe you can check with a (free) tool like Fiddler what is different in the requests

I had some similar issues when serving via PHP.  I don't know PHP at all but I referenced the BLOG here on this site where a user posted a how-to on a To-Do project using PHP to serve up the data. the project zip is in the blog post for DL.   Maybe that would help?


Blog post:

Thanks guys. I'll take a look.

Just to let you now it is now working fine.

Thanks for informing!