View previous topic :: View next topic |
Author |
Message |
BADMoJO -
Joined: 15 Jan 2004 Posts: 1
|
Posted: Thu Jan 15, 2004 12:59 am Post subject: PHP and Virtual Paths.. problem (or possible bug in AWS) |
|
|
Root Folder: C:\HTTPRoot
Documents folder: C:\HTTPRoot\htdocs
I set up a virtual path (C:\Downloads >> http://127.0.0.1/downloads)
I can access it directly just fine in the browser (by navigating to http://127.0.0.1/downloads)
But if I try to use PHP to access it, it gives me errors as if the directory cannot be found.
Code: | <?
$folder = "./downloads/";
$countfiles = 0;
$dh = dir($folder);
while (false !== ($r = $dh->read())) {
if ($r == ".." || $r == ".") continue;
else
{
$countfiles++;
echo "$countfiles. $file";
?> |
Error:
Code: | Warning: dir(./downloads/): failed to open dir: Invalid argument in C:\HTTProot\htdocs\index.php on line 28
(line 28 is: $dh = dir($folder);) |
Anyone have any ideas? This one is really getting to me!
Thanks in advance,
Adam
P.S.
I have tried to set $folder to "/downloads/", "./downloads/", "/downlads". and "./downloads", just for grins, and none of them worked. |
|
Back to top |
|
 |
andy206uk -
Joined: 02 Jan 2004 Posts: 2
|
Posted: Fri Jan 16, 2004 1:04 pm Post subject: |
|
|
I'm having a very similar problem with a script using GD... |
|
Back to top |
|
 |
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Fri Jan 16, 2004 2:07 pm Post subject: |
|
|
My understanding of it is that the because the PHP interpreter when used with Abyss runs as a standalone program it will not have an awareness of any virtual paths you have created... The error being thrown is a PHP error not an error from Abyss so it appears to be your code misbehaving rather than the server... |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri Jan 16, 2004 4:32 pm Post subject: Re: PHP and Virtual Paths.. problem (or possible bug in AWS) |
|
|
BADMoJO,
It seems that you misundertood the meaning of aliases.
Aliases map virtual paths to real paths to hid your real directory structure to the client who is browsing yoru site. Aliases are virtual and are specific to the web server.
Since PHP is a standalone application, you must use the real path of the directories (including the aliases).
So if the alias /downloads corresponds to the real path c:\mydata\downloads, you should use c:\mydata\downloads inside your scripts.
The difference between virtual and real paths is explained in detail in the User's guide of Abyss. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
|