Page 1 of 1

PHP Wintel: different CWP depending on user permissions

Posted: Mon Dec 28, 2009 12:36 pm
by bjazmoore
This is most likely Windows specific. Here is my config:
System Windows NT SCBENAWEB10 5.2 build 3790
Build Date Dec 8 2008 19:30:48
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"
Server API ISAPI
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\WINNT
Loaded Configuration File C:\Program Files\PHP\php.ini
Scan this dir for additional .ini files (none)
additional .ini files parsed (none)
The OS is windows 2003 Advanced Server (32bit) SP1.

I installed a fairly complex system I have been writing locally on my PC. I am an admin on the server and when I load the start page everything works great. Just like it does in my development environment.

I use several common files that are included in the early part of the php file as it is executed:

Code: Select all

require_once ('./includes/functions.php');
require_once ('./includes/mysql_connect.php');
I have set everyone else up in my environment with read and execute permissions to the folder where the code is executed through an AD group (it was not enough to simply use the anonymous IIS user - although I have enabled anonymous access and given rights to that user).

When executed as admin the paths are resolved correctly, but as any other user the paths are not reliable and I get the following error:
Warning: require_once(./includes/functions.php) [function.require-once]: failed to open stream: No such file or directory in E:\dailyReport\index.php on line 32

Fatal error: require_once() [function.require]: Failed opening required './includes/functions.php' (include_path='.;C:\php5\pear') in E:\dailyReport\index.php on line 32
I have echoed the actual CWD and have been surprised to see it is not where the script is executing when I am a general user. This breaks all the code as I used relative file paths.

Does anyone have any insight into why this happens? I know I can force the directory to where the code is executing, but this is not elegant. Ideas. Comments?

Thanks.

Brad

Re: PHP Wintel: different CWP depending on user permissions

Posted: Mon Dec 28, 2009 1:07 pm
by AbraCadaver
I have echoed the actual CWD and have been surprised to see it is not where the script is executing when I am a general user. This breaks all the code as I used relative file paths.
OK, where is it then?

Re: PHP Wintel: different CWP depending on user permissions

Posted: Mon Dec 28, 2009 1:21 pm
by bjazmoore
D:\inetpub\marlboro

That is the path to the root of the site defined by IP address associated with the URL http://marlboro.dnet.domtar (it is an enterprise site behind a corporate firewall so you will not be able to hit it). I have about 20 sub sites in individual folders under this path.

However the URL http://marlboromill.dnet.domtar/dailyReport points to a virtual web running under IIS in the path E:\dailyReport

When I run the site as an administrator I get that path as the CWD. Otherwise it usually is the path shown above (but I have seen other paths that I can not clearly remember - one in the windows directory). It is like the path is not multi-threaded.

Thanks

Re: PHP Wintel: different CWP depending on user permissions

Posted: Mon Dec 28, 2009 1:33 pm
by AbraCadaver
I remember something about this being the "list folders" permission on a directory. Not sure which directory in your case as it's been a loooong time since I used IIS. Might be something to look into.

[CLOSED] PHP Wintel: different CWP depending on user permiss

Posted: Mon Dec 28, 2009 2:23 pm
by bjazmoore
I sure wish I understood what was happening here. I spent a while digging through the permissions until the server froze up. I rebooted it and check things out. The admin user started having the same error. I went into the properties for the virtual site and removed anonymous user again and restarted the ISS. Now things work for both the admin users and the standard users.

Weird thing is - the permissions and settings are exactly the way the were when I started digging into this four hours ago. Now it works. Something is different, but darned if I know what it is...

Thanks for everyone's help.