SLSCoder Posted December 31, 2021 Share Posted December 31, 2021 ubuntu 20.04 php 8.0 I'm using php-fpm to run php from apache2 The file: /etc/php/8.0/fpm/pool.d/www.conf shows: user = www-data group = www-data The file: /etc/apache2/envvars shows: export APACHE_RUN_USER=www-data export APACHE_RUN_GROUP=www-data The file: /etc/apache2/apache2.conf shows: # These need to be set in /etc/apache2/envvars User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} When I run a php file with this code in it: echo get_current_user() . "<br>"; The response I get is: root Why is the logged in user root instead of www-data and how can I reset it so that the logged in user is www-data? Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/314373-why-php-logged-in-user-is-root-not-www-data/ Share on other sites More sharing options...
SLSCoder Posted December 31, 2021 Author Share Posted December 31, 2021 I changed the php code to: echo $_SERVER['USER'] . "<br>"; The response this time was: www-data So now I'm confused.Is the logged in user root or www-data? I need the logged in user to be www-data, not root. Quote Link to comment https://forums.phpfreaks.com/topic/314373-why-php-logged-in-user-is-root-not-www-data/#findComment-1593097 Share on other sites More sharing options...
requinix Posted January 1, 2022 Share Posted January 1, 2022 Read the documentation for get_current_user() and tell me what it says. Quote Link to comment https://forums.phpfreaks.com/topic/314373-why-php-logged-in-user-is-root-not-www-data/#findComment-1593112 Share on other sites More sharing options...
SLSCoder Posted January 3, 2022 Author Share Posted January 3, 2022 OK I get it. thanks Quote Link to comment https://forums.phpfreaks.com/topic/314373-why-php-logged-in-user-is-root-not-www-data/#findComment-1593151 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.