Jump to content
Antonello

MARS Linux apache module

Recommended Posts

Hi,
I installed MARS on linux UBUNTU 18.04 server like a module and works fine with "Hello World" sample

I tried to access a MySQL database but I received a "internal server error" without explain

I tried like a console application and works fine ... I can read the database and display the data

One problem maybe is the .ini file
in the console mode I put the file into same folder of application and ok.

in module mode, I tried to put the file into module folder but I think is wrong

Someone tried this scenario?

thanks!
Antonello

Share this post


Link to post

Hi,

yes, there's a bug in the way MARS defaults the filename for the ini file when deployed as Apache module.

As a workaround you can change this line (in Server.Ignition.pas file):

 

    FEngine.Parameters.LoadFromIniFile;

 

to

 

    FEngine.Parameters.LoadFromIniFile(ChangeFileExt(GetModuleName(HInstance), '.ini'));

 

If your module is located in /etc/apache2/modules/libMyModerverApacheModule.so, the configuration file would be located in the same folder (/etc/apache2/modules/libMyModerverApacheModule.ini).

 

Here's an easy way to check if your config file gets actually loaded:


1) add a Test entry in your config file

[DefaultEngine]

DefaultApp.Test=Hello world!

 

2) add a config function to one of your resources    

[ApplicationParamFunc] MyConfig: TConfigParamFunc;

 

3) return the value from one of your REST methods:

MyConfig('Test').AsString

 

I've fixed the issue in develop branch and backported to master as well ( https://github.com/andrea-magni/MARS/commit/576ecbc5b0798fbec430675be1bcff8fc0ef2600 )

 

Let me know if this solves your problem.

 

Thanks

 

Ciao

 

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
×