Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-07

GetAppConfigDir and GetAppConfigDirUTF8 and Apache

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrea Mauri

Dear all,

I have a question related GetAppConfigDir function when the application is called from a script being run by apache.
One of my application user gets this result from GetAppConfigDir(False):

/root/.config/myappname

since my app uses the local config dir to store some files if the directory does not exit, the app tries to create it. Anyway since the resulting directory is in the root my app is not able to create the file.
Obviously the user doesn't want to give apache root permissions.

Is there any solution? Any hint?

Andrea Mauri

Reply by email

Michael Van Canneyt
to Andrea Mauri
Andrea Mauri wrote 15 lines
Dear all, I have a question related GetAppConfigDir function when the application is called from a script being run by apache. One of my application user gets this result from GetAppConfigDir(False): /root/.config/myappname since my app uses the local config dir to store some files if the directory does not exit, the app tries to create it. Anyway since the resulting directory is in the root my app is not able to create the file. Obviously the user doesn't want to give apache root permissions. Is there any solution? Any hint?

Normally, this means that the program is run as the root user. I do not see how else the GetAppConfigDir can return the root user home dir ?

Michael.

Reply by email

Michael Van Canneyt
to Michael Van Canneyt
Michael Van Canneyt wrote 24 lines
On Thu, 6 Jul 2017, Andrea Mauri via Lazarus wrote: > Dear all, > > I have a question related GetAppConfigDir function when the application > is called from a script being run by apache. > One of my application user gets this result from GetAppConfigDir(False): > > /root/.config/myappname > > since my app uses the local config dir to store some files if the > directory does not exit, the app tries to create it. > Anyway since the resulting directory is in the root my app is not able > to create the file. > Obviously the user doesn't want to give apache root permissions. > > Is there any solution? Any hint? Normally, this means that the program is run as the root user. I do not see how else the GetAppConfigDir can return the root user home dir ?

Forgot to say:

If you let apache set the
XDG_CONFIG_HOME
or
HOME
environment directories to something sensible, they will be used to determine the config dir.

Michael.

Reply by email

Andrea Mauri
to Michael Van Canneyt: Normally, this means that the program is run as the root user. I do not see how else the…
Show quoted text 20 lines
> I have a question related GetAppConfigDir function when the > application is called from a script being run by apache. > One of my application user gets this result from GetAppConfigDir(False): > > /root/.config/myappname > > since my app uses the local config dir to store some files if the > directory does not exit, the app tries to create it. > Anyway since the resulting directory is in the root my app is not able > to create the file. > Obviously the user doesn't want to give apache root permissions. > > Is there any solution? Any hint? Normally, this means that the program is run as the root user. I do not see how else the GetAppConfigDir can return the root user home dir ? Michael.

I cannot test it, I will ask for more details.
Thanks,
Andrea

Reply by email