Reply to Re: Why does is_dir($_SERVER['DOCUMENT_ROOT']) produce false in Windows XP?

Your name:

Reply:


Posted by Erwin Moller on 01/08/07 10:33

comp.lang.php wrote:

>
> Erwin Moller wrote:
>> comp.lang.php wrote:
>>
>> > Env:
>> >
>> > Windows XP, Apache 1.33, PHP 5.2.0
>> >
>> > [PHP]
>> > <?
>> > echo is_dir($_SERVER['DOCUMENT_ROOT']) . " for dir = " .
>> > $_SERVER['DOCUMENT_ROOT']);
>> > ?>
>> > [/PHP]
>> >
>> > Produces
>> > [quote]
>> > for dir = C:/program files/apache group/apache/htdocs
>> > [/quote]
>> >
>> > Why is it in Windows that this occurs? What can I do to circumvent
>> > this?
>> >
>> > Thanx
>> > Phil
>>
>> Hi,
>>
>> Put error on, and you'll see why.
>> Your line contains an error: the closing ) at the end.
>>
>> FOr me on win2000/IIS5 it produces a 1 (true).
>>
>
> Sorry for me it still produces a false; took out the closing ) which I
> put in by mistake, but I still get false. No errors, no warnings, no
> notices, even with error_reporting(E_ALL); and display_errors(true);


In that case PHP thinks the directory doesn't exist, or is not a directory,
but a file.
If you are 100% sure the directory is there, you can try this:

Make sure PHP can SEE the directory.
To do this, check if the user that runs PHP (apache probably) has readrights
on that directory.

Luckily, PHP does not have adminrights by default. :-)

If that doesn't help, maybe the path needs quotes around it because it does
contain a space (I am not sure about that).

You could check this by simply adding them like this:

<?php
echo is_dir("'".$_SERVER['DOCUMENT_ROOT']."'") . " for dir = " .
$_SERVER['DOCUMENT_ROOT'];
?>


Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация