Setting environment variable for apache user2019 Community Moderator ElectionSetting up Apache 2 Local Development Environment & PermissionsSetting user environment variable permanently, outside shell?Setting the TOPCOLORS environment variableCompiling ImageMagick with special path to librairiesSetting environment variable using shell scriptSetting the LANG environment variable for xfceSetting path environment variable for desktop launchersHow can DYLD_LIBRARY_PATH be unset for launchd processes?How to change group for apache user in FedoraApache/Nginx document root environment-variable
How can a new country break out from a developed country without war?
Pre-Employment Background Check With Consent For Future Checks
is this saw blade faulty?
Why is this tree refusing to shed its dead leaves?
"Marked down as someone wanting to sell shares." What does that mean?
What is the reasoning behind standardization (dividing by standard deviation)?
The English Debate
Why is "la Gestapo" feminine?
label a part of commutative diagram
Knife as defense against stray dogs
Hot air balloons as primitive bombers
Animating wave motion in water
What are the consequences of changing the number of hours in a day?
Error in master's thesis, I do not know what to do
Exit shell with shortcut (not typing exit) that closes session properly
DisplayForm problem with pi in FractionBox
Do I need an EFI partition for each 18.04 ubuntu I have on my HD?
Is there any common country to visit for uk and schengen visa?
Fair way to split coins
Could any one tell what PN is this Chip? Thanks~
pipe commands inside find -exec?
Print last inputted byte
CLI: Get information Ubuntu releases
How can an organ that provides biological immortality be unable to regenerate?
Setting environment variable for apache user
2019 Community Moderator ElectionSetting up Apache 2 Local Development Environment & PermissionsSetting user environment variable permanently, outside shell?Setting the TOPCOLORS environment variableCompiling ImageMagick with special path to librairiesSetting environment variable using shell scriptSetting the LANG environment variable for xfceSetting path environment variable for desktop launchersHow can DYLD_LIBRARY_PATH be unset for launchd processes?How to change group for apache user in FedoraApache/Nginx document root environment-variable
I tried what not:
- in
/etc/profile.d/
I created a script fileapachhe.sh
with contentif [ $UID -eq 48 ]; then . export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; fi
- in
/etc/environment
I addedLD_LIBRARY_PATH=/usr/local/lib
- in
/etc/sysconfig/httpd
I addedLD_LIBRARY_PATH=/usr/local/lib
Restarting apache
thru phpinfo()
I see the variable set properly but when I try to call the program that needs this variable from a script as <?php exec('the_exe'); ?>
, I still get an error that the system can't find a lib file.
I finally managed to do a workaround by calling putenv("LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH");
from the PHP
script prior to the exec
call but I don't want to do this on every request. Any ideas how to set the variable for apache properly? What do I miss?
BTW PHP
is running as fpm
under apache
user. The OS is CentOS 7
. Thanks.
apache-httpd environment-variables php
add a comment |
I tried what not:
- in
/etc/profile.d/
I created a script fileapachhe.sh
with contentif [ $UID -eq 48 ]; then . export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; fi
- in
/etc/environment
I addedLD_LIBRARY_PATH=/usr/local/lib
- in
/etc/sysconfig/httpd
I addedLD_LIBRARY_PATH=/usr/local/lib
Restarting apache
thru phpinfo()
I see the variable set properly but when I try to call the program that needs this variable from a script as <?php exec('the_exe'); ?>
, I still get an error that the system can't find a lib file.
I finally managed to do a workaround by calling putenv("LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH");
from the PHP
script prior to the exec
call but I don't want to do this on every request. Any ideas how to set the variable for apache properly? What do I miss?
BTW PHP
is running as fpm
under apache
user. The OS is CentOS 7
. Thanks.
apache-httpd environment-variables php
1
Did you try adding the line in/etc/sysconfig/php-fpm
and then restarting php-fpm withsystemctl restart php-fpm.service
?
– sebasth
Sep 18 '17 at 12:46
1
sounds very much like the variable isn't being exported; if the syntax in #1 is really. export LD...
then you're not actually exporting there; removing the.
(period) would get you a lot closer.
– Jeff Schaller
Sep 18 '17 at 12:53
@sebasth thanks. I tried it but doesn't work. I've restarted both - apache and the php-fpm process.
– Martin Dimitrov
Sep 18 '17 at 13:30
@JeffSchaller I changed the syntax but still doesn't work. I've restarted the services but do I need to restart the server itself?
– Martin Dimitrov
Sep 18 '17 at 13:32
1
I wouldn't think so, no. Possible that apache has the variable set but isn't exporting it to the child PHP processes.
– Jeff Schaller
Sep 18 '17 at 13:33
add a comment |
I tried what not:
- in
/etc/profile.d/
I created a script fileapachhe.sh
with contentif [ $UID -eq 48 ]; then . export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; fi
- in
/etc/environment
I addedLD_LIBRARY_PATH=/usr/local/lib
- in
/etc/sysconfig/httpd
I addedLD_LIBRARY_PATH=/usr/local/lib
Restarting apache
thru phpinfo()
I see the variable set properly but when I try to call the program that needs this variable from a script as <?php exec('the_exe'); ?>
, I still get an error that the system can't find a lib file.
I finally managed to do a workaround by calling putenv("LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH");
from the PHP
script prior to the exec
call but I don't want to do this on every request. Any ideas how to set the variable for apache properly? What do I miss?
BTW PHP
is running as fpm
under apache
user. The OS is CentOS 7
. Thanks.
apache-httpd environment-variables php
I tried what not:
- in
/etc/profile.d/
I created a script fileapachhe.sh
with contentif [ $UID -eq 48 ]; then . export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; fi
- in
/etc/environment
I addedLD_LIBRARY_PATH=/usr/local/lib
- in
/etc/sysconfig/httpd
I addedLD_LIBRARY_PATH=/usr/local/lib
Restarting apache
thru phpinfo()
I see the variable set properly but when I try to call the program that needs this variable from a script as <?php exec('the_exe'); ?>
, I still get an error that the system can't find a lib file.
I finally managed to do a workaround by calling putenv("LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH");
from the PHP
script prior to the exec
call but I don't want to do this on every request. Any ideas how to set the variable for apache properly? What do I miss?
BTW PHP
is running as fpm
under apache
user. The OS is CentOS 7
. Thanks.
apache-httpd environment-variables php
apache-httpd environment-variables php
asked Sep 18 '17 at 12:16
Martin DimitrovMartin Dimitrov
1013
1013
1
Did you try adding the line in/etc/sysconfig/php-fpm
and then restarting php-fpm withsystemctl restart php-fpm.service
?
– sebasth
Sep 18 '17 at 12:46
1
sounds very much like the variable isn't being exported; if the syntax in #1 is really. export LD...
then you're not actually exporting there; removing the.
(period) would get you a lot closer.
– Jeff Schaller
Sep 18 '17 at 12:53
@sebasth thanks. I tried it but doesn't work. I've restarted both - apache and the php-fpm process.
– Martin Dimitrov
Sep 18 '17 at 13:30
@JeffSchaller I changed the syntax but still doesn't work. I've restarted the services but do I need to restart the server itself?
– Martin Dimitrov
Sep 18 '17 at 13:32
1
I wouldn't think so, no. Possible that apache has the variable set but isn't exporting it to the child PHP processes.
– Jeff Schaller
Sep 18 '17 at 13:33
add a comment |
1
Did you try adding the line in/etc/sysconfig/php-fpm
and then restarting php-fpm withsystemctl restart php-fpm.service
?
– sebasth
Sep 18 '17 at 12:46
1
sounds very much like the variable isn't being exported; if the syntax in #1 is really. export LD...
then you're not actually exporting there; removing the.
(period) would get you a lot closer.
– Jeff Schaller
Sep 18 '17 at 12:53
@sebasth thanks. I tried it but doesn't work. I've restarted both - apache and the php-fpm process.
– Martin Dimitrov
Sep 18 '17 at 13:30
@JeffSchaller I changed the syntax but still doesn't work. I've restarted the services but do I need to restart the server itself?
– Martin Dimitrov
Sep 18 '17 at 13:32
1
I wouldn't think so, no. Possible that apache has the variable set but isn't exporting it to the child PHP processes.
– Jeff Schaller
Sep 18 '17 at 13:33
1
1
Did you try adding the line in
/etc/sysconfig/php-fpm
and then restarting php-fpm with systemctl restart php-fpm.service
?– sebasth
Sep 18 '17 at 12:46
Did you try adding the line in
/etc/sysconfig/php-fpm
and then restarting php-fpm with systemctl restart php-fpm.service
?– sebasth
Sep 18 '17 at 12:46
1
1
sounds very much like the variable isn't being exported; if the syntax in #1 is really
. export LD...
then you're not actually exporting there; removing the .
(period) would get you a lot closer.– Jeff Schaller
Sep 18 '17 at 12:53
sounds very much like the variable isn't being exported; if the syntax in #1 is really
. export LD...
then you're not actually exporting there; removing the .
(period) would get you a lot closer.– Jeff Schaller
Sep 18 '17 at 12:53
@sebasth thanks. I tried it but doesn't work. I've restarted both - apache and the php-fpm process.
– Martin Dimitrov
Sep 18 '17 at 13:30
@sebasth thanks. I tried it but doesn't work. I've restarted both - apache and the php-fpm process.
– Martin Dimitrov
Sep 18 '17 at 13:30
@JeffSchaller I changed the syntax but still doesn't work. I've restarted the services but do I need to restart the server itself?
– Martin Dimitrov
Sep 18 '17 at 13:32
@JeffSchaller I changed the syntax but still doesn't work. I've restarted the services but do I need to restart the server itself?
– Martin Dimitrov
Sep 18 '17 at 13:32
1
1
I wouldn't think so, no. Possible that apache has the variable set but isn't exporting it to the child PHP processes.
– Jeff Schaller
Sep 18 '17 at 13:33
I wouldn't think so, no. Possible that apache has the variable set but isn't exporting it to the child PHP processes.
– Jeff Schaller
Sep 18 '17 at 13:33
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f392940%2fsetting-environment-variable-for-apache-user%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f392940%2fsetting-environment-variable-for-apache-user%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Did you try adding the line in
/etc/sysconfig/php-fpm
and then restarting php-fpm withsystemctl restart php-fpm.service
?– sebasth
Sep 18 '17 at 12:46
1
sounds very much like the variable isn't being exported; if the syntax in #1 is really
. export LD...
then you're not actually exporting there; removing the.
(period) would get you a lot closer.– Jeff Schaller
Sep 18 '17 at 12:53
@sebasth thanks. I tried it but doesn't work. I've restarted both - apache and the php-fpm process.
– Martin Dimitrov
Sep 18 '17 at 13:30
@JeffSchaller I changed the syntax but still doesn't work. I've restarted the services but do I need to restart the server itself?
– Martin Dimitrov
Sep 18 '17 at 13:32
1
I wouldn't think so, no. Possible that apache has the variable set but isn't exporting it to the child PHP processes.
– Jeff Schaller
Sep 18 '17 at 13:33