473,326 Members | 2,173 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,326 software developers and data experts.

Windows registry access in PHP webpage possible?

Has anyone ever managed to read a Windows registry key in a PHP webpage? I
installed the PHP extension win32std and saved their sample script from
http://wildphp.free.fr/wiki/doku.php...egistry_access as a
webpage. However when I open the webpage (PHP 5.1.2, Windows Server 2003,
IIS 6) I get the error message "Warning: Can't open registry key: The
operation completed successfully." Is registry access only possible in
Windows executables?

Boris
Jan 27 '06 #1
6 8990
*** Boris escribió/wrote (Fri, 27 Jan 2006 18:32:36 +0100):
Has anyone ever managed to read a Windows registry key in a PHP webpage? I
installed the PHP extension win32std and saved their sample script from
http://wildphp.free.fr/wiki/doku.php...egistry_access as a
webpage. However when I open the webpage (PHP 5.1.2, Windows Server 2003,
IIS 6) I get the error message "Warning: Can't open registry key: The
operation completed successfully." Is registry access only possible in
Windows executables?


Just speculating... Apache normally runs under the local system account, if
I recall correctly. The chosen registry key may have more restrictive
permissions.

I suggest you first try to run your script from the command line, so it has
the same privileges as your personal user. If that's the issue, it can be
fixed later.
--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Jan 27 '06 #2
*** Alvaro G. Vicario escribió/wrote (Fri, 27 Jan 2006 23:24:46 +0100):
Apache normally runs under the local system account


Where I said Apache please read IIS and where I said system account please
read IUSR_FOOBAR. See the "Services" snap-in console for further info.
--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Jan 27 '06 #3
Boris wrote:
Has anyone ever managed to read a Windows registry key in a PHP webpage? I
installed the PHP extension win32std and saved their sample script from
http://wildphp.free.fr/wiki/doku.php...egistry_access as a
webpage. However when I open the webpage (PHP 5.1.2, Windows Server 2003,
IIS 6) I get the error message "Warning: Can't open registry key: The
operation completed successfully." Is registry access only possible in
Windows executables?

Boris

If anything other than the local running user is able to read the
registry, I would consider that a breach of security - BAD - VERY BAD
IDEA.

Another reason to ditch winbloze and go Linux for a desktop.

Michael Austin.
Jan 28 '06 #4

"Alvaro G. Vicario" <we*******@NOSPAMdemogracia.com>,
news:10*****************************@40tude.net...
*** Boris escribió/wrote (Fri, 27 Jan 2006 18:32:36 +0100):
Has anyone ever managed to read a Windows registry key in a PHP webpage?
I
installed the PHP extension win32std and saved their sample script from
http://wildphp.free.fr/wiki/doku.php...egistry_access as
a
webpage. However when I open the webpage (PHP 5.1.2, Windows Server 2003,
IIS 6) I get the error message "Warning: Can't open registry key: The
operation completed successfully." Is registry access only possible in
Windows executables?
Just speculating... Apache normally runs under the local system account,
if
I recall correctly. The chosen registry key may have more restrictive
permissions.


The script tries to read "HKEY_CURRENT_USER\Control Panel". As far as I know
this key exists for all user accounts. And each user should be able to read
his HKEY_CURRENT_USER branch, too.
I suggest you first try to run your script from the command line, so it
has
the same privileges as your personal user. If that's the issue, it can be
fixed later.


Thanks, I tried that. It works! Actually I would agree that it is a
permission issue but see above. According to
http://support.microsoft.com/kb/163846/en-us the registry keys of the SYSTEM
account are stored at \HKEY_USERS\S-1-5-18. When I check
"\HKEY_USERS\S-1-5-18\Control Panel" the SYSTEM account does have
read-access. I would expect the PHP webpage to be able to find and read this
key under \HKEY_CURRENT_USER?

Boris
Jan 28 '06 #5
*** Boris escribió/wrote (Sat, 28 Jan 2006 14:28:04 +0100):
Thanks, I tried that. It works! Actually I would agree that it is a
permission issue but see above. According to
http://support.microsoft.com/kb/163846/en-us the registry keys of the SYSTEM
account are stored at \HKEY_USERS\S-1-5-18. When I check
"\HKEY_USERS\S-1-5-18\Control Panel" the SYSTEM account does have
read-access. I would expect the PHP webpage to be able to find and read this
key under \HKEY_CURRENT_USER?


Please read my second message. IIS runs under its own user, typically
called IUSR_MACHINENAME.

--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Jan 29 '06 #6

"Alvaro G. Vicario" <we*******@NOSPAMdemogracia.com>,
news:zx*****************************@40tude.net...
*** Boris escribió/wrote (Sat, 28 Jan 2006 14:28:04 +0100):
Thanks, I tried that. It works! Actually I would agree that it is a
permission issue but see above. According to
http://support.microsoft.com/kb/163846/en-us the registry keys of the
SYSTEM
account are stored at \HKEY_USERS\S-1-5-18. When I check
"\HKEY_USERS\S-1-5-18\Control Panel" the SYSTEM account does have
read-access. I would expect the PHP webpage to be able to find and read
this
key under \HKEY_CURRENT_USER?


Please read my second message. IIS runs under its own user, typically
called IUSR_MACHINENAME.


I created now a new application pool for the virtual directory which
contains the PHP script and explicitly set the user account to NETWORK
SERVICE. This is the same user account used by ASP.NET scripts. While the
ASP.NET script can access the registry the PHP script still returns the same
error. Meanwhile I also contacted one of the developers of the PHP extension
and asked him if he ever ran his sample script succesfully from a webpage.
If I get an answer I'll forward it.

Boris
Jan 29 '06 #7

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

Similar topics

16
by: Paul Rubin | last post by:
As what must be penance for something or other, I'm needing to release a Python app for use under Windows XP. Please be gentle with me since I'm a Un*x weenie and the only thing I've had much...
5
by: Dhilip Kumar | last post by:
Hi All, I'm writing a Windows Service app using C#. I need to read some configuration settings before the service starts up. These settings will be used by the service in its operation. ...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
1
by: PrettySneaky | last post by:
I currently working on a webservice which calls a DCOM object! The webproject works just fine when i run it in Visual studio 2005. However due to some compability issues with .NET 2.0 and the...
4
by: korund | last post by:
Is there any difference to read & write to windows Registry with VBScript or JavaScript? Both scripting languages have similar syntax. What is preferable use for this? thanks.
16
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I'm looking for a way to programmatically retrieve the following if possible: Windows Installation Key or COA from the registry Windows installed...
2
by: Ntl News Group | last post by:
Is it possible to run Access 97 on Windows Vista? I have installed Access 97 and Access 2000, when I run Access 2000, then try to open Access 97 it says it cant find the windows registry entries?...
5
by: =?Utf-8?B?Qkw=?= | last post by:
Hello friends In c# 2005 I have written a function to access "font file name" by "Font name" and it is working fine in all the windows version other than vista, in vista it is throughing an...
1
by: kbnumesh | last post by:
Dear All, I have query regarding the registry. Is it possible to write it to windows registry using the XML? if yes then what is the API or tag used to write it. I am just a beginner in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.