473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

PHP on IIS with basic authentication

I'm running PHP on IIS and need to set basic authentication on a
particular folder, e.g http://domain.com/private/
I've set the user on the server and assigned permissions to the
folder.

When requesting files within the folder, I get the login/password
prompt and entering the correct credentials gives me the file, except
for .php files.

The .php file is as basic as they come with just <?php echo "Hello
world"; ?as the contents.

http://domain.com/private/test.txt works perfectly, however
http://domain.com/private/test.php denies access, giving only:
"Unauthorized
Access is denied due to invalid credentials."

I've tried giving the user full permissions; I've ensured that
Application Settings configuration within IIS Manager properties >
Home Directory, allows PHP files.
Any other suggestions?

Aug 2 '07 #1
12 4093
Joff wrote:
I'm running PHP on IIS and need to set basic authentication on a
particular folder, e.g http://domain.com/private/
I've set the user on the server and assigned permissions to the
folder.

When requesting files within the folder, I get the login/password
prompt and entering the correct credentials gives me the file, except
for .php files.

The .php file is as basic as they come with just <?php echo "Hello
world"; ?as the contents.

http://domain.com/private/test.txt works perfectly, however
http://domain.com/private/test.php denies access, giving only:
"Unauthorized
Access is denied due to invalid credentials."

I've tried giving the user full permissions; I've ensured that
Application Settings configuration within IIS Manager properties >
Home Directory, allows PHP files.
Any other suggestions?
What you describe sounds like windows integrated authentication not like
basic authentication. In this cases the user login on needs access to
the file on the server. If it is what you mean, the user may even need
the rights to execute that .php file as well as the right to execute php
itself.

Heiko
Aug 2 '07 #2
In that case it might be my understanding of IIS basic authentication
and how it (should) works.

This is what I'm currently doing:

IIS Manager domain.com - private folder properties Directory
Security Authentication and access control - Edit
Unchecked "Enable anonymous access"
Checked only "Basic authentication (password is sent in clear text)"

Then to assign the user:

IIS Manager domain.com - private folder permissions Assign full
control to "test" user
(I'm assigning full control at present to try and establish where the
problem lies)

Aug 2 '07 #3
Joff wrote:
In that case it might be my understanding of IIS basic authentication
and how it (should) works.

This is what I'm currently doing:

IIS Manager domain.com - private folder properties Directory
Security Authentication and access control - Edit
Unchecked "Enable anonymous access"
Checked only "Basic authentication (password is sent in clear text)"

Then to assign the user:

IIS Manager domain.com - private folder permissions Assign full
control to "test" user
(I'm assigning full control at present to try and establish where the
problem lies)
Are you running PHP as a CGI or a isapi module?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 2 '07 #4
On Aug 2, 6:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Are you running PHP as a CGI or a isapi module?

Embarrassingly, I don't know. It's a Windows 2k3 VPS running Plesk/
Virtuozzo if that helps to narrow it down? Is there any way to check?

Aug 2 '07 #5
Joff wrote:
On Aug 2, 6:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Are you running PHP as a CGI or a isapi module?


Embarrassingly, I don't know. It's a Windows 2k3 VPS running Plesk/
Virtuozzo if that helps to narrow it down? Is there any way to check?
Sorry, no. I don't use Plesk/Virtuozo so I have no idea. The only
Windows sites I have are VPS's.

The reason I'm asking - if you're running PHP as a CGI, chances are you
need to set permissions on the php.exe file itself for this user.

If you're running as an ASPI file, it should work.

But I don't guarantee that - I'm definitely not an expert on IIS and
Windows security. Normally I run as an isapi, which works well. I have
the PHP DLL set to be readable and executable by everyone.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 3 '07 #6
Jerry Stuckle wrote:
Joff wrote:
>On Aug 2, 6:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>Are you running PHP as a CGI or a isapi module?


Embarrassingly, I don't know. It's a Windows 2k3 VPS running Plesk/
Virtuozzo if that helps to narrow it down? Is there any way to check?

Sorry, no. I don't use Plesk/Virtuozo so I have no idea. The only
Windows sites I have are VPS's.

The reason I'm asking - if you're running PHP as a CGI, chances are you
need to set permissions on the php.exe file itself for this user.

If you're running as an ASPI file, it should work.
That should be ISAPI. Sorry.
But I don't guarantee that - I'm definitely not an expert on IIS and
Windows security. Normally I run as an isapi, which works well. I have
the PHP DLL set to be readable and executable by everyone.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 3 '07 #7
Cheers Jerry,

I have remote access to the VPS too (I just mentioned Plesk/Virtuozzo
incase that helped identify the type of PHP installation).

How do I check to see whether mine's CGI or ISAPI? Is it just a case
of looking at the running services?
Aug 3 '07 #8
I've had a dig around and within the Mappings tab (Internet Services
Manager Web Site Home Directory Configure) I've found that .php
and .php3 files are mapped to php-cgi.exe
Aug 3 '07 #9
On Aug 3, 9:07 am, Joff <jonat...@gattonero.co.ukwrote:
I've had a dig around and within the Mappings tab (Internet Services
Manager Web Site Home Directory Configure) I've found that .php
and .php3 files are mapped to php-cgi.exe
Further to the above.

If I set the test user with full permissions to php-cgi.exe, then
requesting within the /private folder .php files now give a "Internal
Server Error" message.
Aug 3 '07 #10
Joff wrote:
On Aug 3, 9:07 am, Joff <jonat...@gattonero.co.ukwrote:
>I've had a dig around and within the Mappings tab (Internet Services
Manager Web Site Home Directory Configure) I've found that .php
and .php3 files are mapped to php-cgi.exe

Further to the above.

If I set the test user with full permissions to php-cgi.exe, then
requesting within the /private folder .php files now give a "Internal
Server Error" message.

You also need to ensure your php.ini file and all dll's loaded have the
appropriate permissions. Basically anything which PHP might load.

BTW - I normally run PHP as an isapi. It's more efficient and
integrates better.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 3 '07 #11
On Aug 3, 12:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
You also need to ensure your php.ini file and all dll's loaded have the
appropriate permissions. Basically anything which PHP might load.
Thanks, I'll go through and check them all.

BTW - I normally run PHP as an isapi. It's more efficient and
integrates better.
How do I switch over to ISAPI from the current set up?
Aug 5 '07 #12
Joff wrote:
On Aug 3, 12:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>You also need to ensure your php.ini file and all dll's loaded have the
appropriate permissions. Basically anything which PHP might load.

Thanks, I'll go through and check them all.

>BTW - I normally run PHP as an isapi. It's more efficient and
integrates better.

How do I switch over to ISAPI from the current set up?

<http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=0uj&q=php+isapi&btnG=Search>

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 5 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Phil Powell | last post by:
/*-------------------------------------------------------------------------------------------- This function will utilize the ability to use HTTP-based WWW Authentication, checking for the global...
7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
1
by: Oran | last post by:
I am trying to integrate an application into our extranets. The extranet technology has its own authentication system requiring a domain user but uses anonymous authentication (from the...
4
by: Joseph | last post by:
I have an intranet application that I setup using windows authentication through IIS basic authentication. Is there a way to set a timeout, so that after ten minutes the user will be prompted...
4
by: Dave | last post by:
Hi, Is there anyway to mimic forms authentication's loginUrl and RedirectFromLoginPage functionality using Windows authentication? We are developing intranet sites using basic authentication...
4
by: Barry | last post by:
The MS fix for IE broke how users access our site (if they patch their browsers), so I need a solution to get users logged onto our site transparently. Basically we used to log on to the site...
2
by: Chad Beckner | last post by:
Hi everyone, I am developing a site in which the root will be set with Anonymous & Basic permissions. Past that I will have an application (directory) in which I will be developing...
3
by: sefe dery | last post by:
hi ng, i try to create a asp.net 1.0 website on windows server 2003(Servername: ServerX) with iis 6.0. PROBLEM: The user should login with his windows credentials in basic.aspx and...
3
by: Martin | last post by:
How does one set up basic authentication on an HttpListener? I know I need to set the HttpListener.AuthenticationSchemes to AuthenticationSchemes.Basic but then I'm unsure how and against what...
0
by: =?Utf-8?B?S29uc3RhbnRpbg==?= | last post by:
I am currently working on the application that need to simulate basic authentication programmatically using user's credentials that are known. Basically, the need is for a single sign on with a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.