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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.