Jump to content

$_SERVER['REMOTE_USER']


Snewzzer

Recommended Posts

Hi

 

I have inherited some code which has been placed on a new LAMP server, intended to replace an ageing system.The code uses the $_SERVER['REMOTE_USER'] variable but when ran through the Webrowser doesn't work.

phpinfo() reveals that the $_SERVER['REMOTE_USER'] variable does not exist. It does exist though on the server where the code originally comes from.

My problem is how to enable the use of $_SERVER['REMOTE_USER'] on this newly built server.

Thanks in advance for any help.

Link to comment
https://forums.phpfreaks.com/topic/236631-_serverremote_user/
Share on other sites

You need an .htaccess file first. A basic .htaccess file, for testing purposes:

 

.htaccess

AuthName "restricted stuff"
AuthType Basic
AuthUserFile /etc/.htpasswd
require valid-user

Place that file in the folder that you are wanting protected (or the root of the site, if you want ALL things protected)

 

next, run this:

htpasswd -c /etc/.htpasswd user1

it will ask for a password for user1 (change the user to the username you want to use)

for all other users, do this:

htpasswd /etc/.htpasswd user2
htpasswd /etc/.htpasswd user3
etc...

 

Link to comment
https://forums.phpfreaks.com/topic/236631-_serverremote_user/#findComment-1216883
Share on other sites

Sorry, I should have given more detail. The Webpage loads automatically without a username and password as long as the logged in user is a member of the required Windows Active Directory group. Therefore I do not need to set a password for each user as your method describes as AD takes care of this.

We are trying to make an exact duplicate of an existing system onto a new server, as this is how the original system works.

Link to comment
https://forums.phpfreaks.com/topic/236631-_serverremote_user/#findComment-1216913
Share on other sites

Yes jonsjava, PHP LDAP was installed and apache restarted. Thanks for keep coming back to me.

I have progressed to this point :-

The following line needs to be added to the apache2.conf file ...

LoadModule ntlm_winbind_module /usr/lib/apache2/modules/mod_auth_ntlm_winbind.so

But when added apache would not restart.. cannot find file mod_auth_ntlm_winbind.

Searched further and came across the following instruction on how to install it ...

#autoconfig

./configure

apxs2 -DAPACHE2 -c -i mod-auth_ntlm_winbind.c

 

Had to install autoconfig first with apt-get install autoconfig but now when trying to run above command I get ...

autoconfig error no input file

Pretty much drawing a blank from then on.

 

Link to comment
https://forums.phpfreaks.com/topic/236631-_serverremote_user/#findComment-1216993
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.