Re: [PHP] Working directory of PHP pages?

2009-03-11 Thread Per Jessen
Clancy wrote:

> It is my understanding that when you open a page the PHP server looks
> for index.php in the site root directory, and loads it. 

A typical Apache configuration will have 'DirectoryIndex index' and will
look for 'index' when there is no specific file given.  It looks in
whichever directory the URL indicates.  With Multiviews enabled, Apache
will look for anything matching 'index.*' and decided which file is the
best match and then serve that. 


/Per

-- 
Per Jessen, Zürich (5.8°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Working directory of PHP pages?

2009-03-10 Thread Michael Kubler

You can configure different index file names for Apache to check for.
e.g index.html, index.htm, index.php, default.htm

I had one webserver where it would only accept default.htm as the file, 
and didn't allow .htaccess files.


Michael Kubler
*G*rey *P*hoenix *P*roductions 



Clancy wrote:

It is my understanding that when you open a page the PHP server looks for 
index.php in the
site root directory, and loads it. As a result the working directory of the 
page will be
the root directory of the site.  I have always worked on this assumption, and 
it has
always been correct.  On the other hand Stewart thinks that I cannot rely this, 
and am
likely to get into trouble as a result.

Are there any systems in which my assumption will not be correct?


  


Re: [PHP] Working directory of PHP pages?

2009-03-10 Thread Chris

Clancy wrote:

It is my understanding that when you open a page the PHP server looks for 
index.php in the
site root directory, and loads it.


The web server (not php) looks for an index.php file (if configured to 
do so) based on the path.


http://www.example.com/subdir/folder/

will look in subdir/folder/ for an index file first.

You can use mod_rewrite or something similar to point everything to 
http://www.example.com/index.php .


 As a result the working directory of the page will be

the root directory of the site.  I have always worked on this assumption, and 
it has
always been correct.  On the other hand Stewart thinks that I cannot rely this, 
and am
likely to get into trouble as a result.



Are there any systems in which my assumption will not be correct?


Symlinked folders. You don't have the "real" working directory.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Working directory of PHP pages?

2009-03-10 Thread Clancy
It is my understanding that when you open a page the PHP server looks for 
index.php in the
site root directory, and loads it. As a result the working directory of the 
page will be
the root directory of the site.  I have always worked on this assumption, and 
it has
always been correct.  On the other hand Stewart thinks that I cannot rely this, 
and am
likely to get into trouble as a result.

Are there any systems in which my assumption will not be correct?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php