PHP and Virtual Paths.. problem (or possible bug in AWS)

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
BADMoJO
-


Joined: 15 Jan 2004
Posts: 1

PostPosted: Thu Jan 15, 2004 12:59 am    Post subject: PHP and Virtual Paths.. problem (or possible bug in AWS) Reply with quote

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 View user's profile Send private message
andy206uk
-


Joined: 02 Jan 2004
Posts: 2

PostPosted: Fri Jan 16, 2004 1:04 pm    Post subject: Reply with quote

I'm having a very similar problem with a script using GD...
Back to top View user's profile Send private message
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Fri Jan 16, 2004 2:07 pm    Post subject: Reply with quote

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 View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Jan 16, 2004 4:32 pm    Post subject: Re: PHP and Virtual Paths.. problem (or possible bug in AWS) Reply with quote

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 View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group