Web Hosting Talk







View Full Version : PHP - Windows Authentication


creativeartist
07-08-2008, 02:00 AM
I have PHP website running on an apache 2.2 webserver which is in a Windows Network. All users log in on their computers with a network account.

If this is the case I would need to get their network account user name for the each person's login.So the login to website will be authenticated using their username

How can I get this using php???.Please help me on this

Dark Light
07-08-2008, 03:45 AM
This is certainly possible while running PHP on IIS, however I've never tried it using Apache. Your best bet to start with would be to create a phpinfo() file and check the variables at the bottom when you view it with an authenticated network account. This may give you some header information; possibly allowing you to find out what the network username is.

If you have the option to, you might want to try and use IIS to handle the authentication. That way, IIS can interface with your domain or network and authenticate users before they hit your PHP page(s).

Hope that helps,

creativeartist
07-08-2008, 03:52 AM
I have tried in Apache and got stuck with this.phpinfo() is showing the machine network name but no user information.

Any one is there to helppp????

Dark Light
07-08-2008, 03:58 AM
Fair enough. I didn't think phpinfo() under plain Apache would yield much.

Have you tried some of the other non-default Apache modules under Windows? Take a look at:

http://www.apachelounge.com/forum/viewtopic.php?p=5373

Hope that helps,

creativeartist
07-08-2008, 12:01 PM
Is there any other way using vbscript or wsd??.

Dark Light
07-08-2008, 12:07 PM
I'm sure you could create an application on the client to automatically authenticate them, but it would be overkill.

It would be far easier to implement one of the solutions with the additional Apache modules in the thread I linked to above - or just switch to IIS and NTLM. If you are having trouble with a specific module your best bet would be Google as a lot of other people have gone through and posted solutions to many of the common problems.

creativeartist
07-09-2008, 12:05 AM
I will try using updating apache.Thank you

insanelymacintosh
07-09-2008, 02:41 AM
Are you saying that people (maybe on a local network) go to a website (maybe local as well) and you would like for the website to get the username that client computer is logged in as? I do not know of any php functions/variables that will allow you to see the username that the client's PC is logged in as.

Dark Light
07-09-2008, 03:41 AM
Are you saying that people (maybe on a local network) go to a website (maybe local as well) and you would like for the website to get the username that client computer is logged in as? I do not know of any php functions/variables that will allow you to see the username that the client's PC is logged in as.

It's entirely possible with IIS, NTLM and/or LDAP depending on if you just want their username or their entire Active Directory details. Usually you would be using IIS along with a Windows Domain - allowing you to setup IIS to authenticate the user as a valid domain account and forward along the domain username as a header before the user touches your script or application.

It's also possible under Apache on Unix to do the same thing, and somewhat more tricky to get it to work under Apache on Windows. ;)

By using this method you can create a Single Sign-On environment where you would only have to logon to your computer once and you would automatically be logged onto the appropriate Intranet or possibly Internet services.

Hope that helps,

creativeartist
07-13-2008, 12:19 PM
Thank you updating apache worked on my machine.