PHP cant see directory?

Started by
6 comments, last by SyncViews 12 years, 6 months ago
I thought Id do some webstuff, make a highscore system, perhaps some update thing, however I am having issue with directories. The origenal problem was I wanted the directory containing the PHP file as the working directory, not the PHP installation directory (using with FastCGI on IIS), however it seems I cant see the webroot directory at all???

[source]
<?php
//script E:\Projects\Site\test.php
//chdir(dirname(__FILE__));//fails
//chdir('E:\\Projects\\Site\\'); //fails
echo file_exists('E:\\Projects\\Site') . '<br/>'; //false
echo file_exists('E:\\Projects') . '<br/>'; //true
echo file_exists('E:\\Projects\\Site\\Downloads') . '<br/>';//true
?>
[/source]

How is that even possible?
Advertisement
A few guesses would be, you're either running in php's safe mode, or the privileges on the "Site" folder make it so php can't access it.
Downloads just inherits the privileges of Site. Sfe mode is off in my php.ini
What privileges do you have set for Site? Do you have an index.php in "Projects" and in "Downloads"?
Both have an index.php (relevance?).

Downloads inherits the Site folder privledeges (except CREATOR OWNER, but there set the same anyway), Site has:
IUSR: transverse/execute, list/read data, read attributes, read extended attributes, read
IIS_IUSRS: Same
SYSTEM, CREATOR OWNER, My Account, Administrators: All

Task manager has PHP as "DefaultAppPool" username, but I couldnt find any such thing?
The next question would be does Site have an index.php. I was thinking maybe the function was trying to check for an index in the directories. As a test, have you set all 3 directories to 777? Don't assume inheritance. Sometimes files/folders attempt to keep their previous settings.
Two things to look at...

There use to be a bug in php 5.3 (you didn't say what version you are running), under windows and this stackoverflow question which claims the parent directory needs read permissions.

The next question would be does Site have an index.php. I was thinking maybe the function was trying to check for an index in the directories. As a test, have you set all 3 directories to 777? Don't assume inheritance. Sometimes files/folders attempt to keep their previous settings.


I said both have an index. When viewing somthing like say "Effective Permissions" on the files and directories in windows, there the same for all of them. I could try a 777 "all for everything" permission set I suppose, but I'm pretty much positive that is not needed.

It was a clean PHP install shortly before starting this topic, off http://windows.php.net/download/, so 5.3.8. I did not use any symlinks (i.e. E:\Projects\Site is the real folder, and the "Default Web Site" physical path is set to that).

This topic is closed to new replies.

Advertisement