Relative addressing issue.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,

Win 2k3 server
Apache 2.0.59
PHP 5.2.4
Eclipse 3.3

I have been teaching myself open source web development utilizing a book  
which I highly recommend for developers from other environments learning  
XAMP web development:  Core Web Application Development with PHP and MySQL.

I copied and modified some examples from the CD and have worked through most  
of my issues so far. I'm stuck on a problem that I think is due to some  
configuration item.

This is my web file structure relevant to the issue:


In  the "/includes" folder I have several files, among them is a file called  
errors.php containing an error class. I get the following entries in the  
Apache error log when I execute a page that calls the error function:

[Thu Sep 20 14:52:18 2007] [error] [client] PHP Warning:  
error_log(../../logs/tbwe_log.log) [<a  
href='function.error-log'>function.error-log</a>]: failed to open stream: No  
such file or directory in C:\Web\Tbwe\includes\errors.php on line 61
[Thu Sep 20 14:52:18 2007] [error] [client] script  
'C:/Web/Tbwe/includes/error.php' not found or unable to stat
[Thu Sep 20 14:52:19 2007] [error] [client] script  
'C:/Web/Tbwe/includes/error.php' not found or unable to stat
[Thu Sep 20 14:52:27 2007] [error] [client] script  
'C:/Web/Tbwe/includes/error.php' not found or unable to stat

***First error:
Line 61 in the errors.php file:
            . " Unhandled Error ($in_errfile, $in_errline): "
            . "$in_errno, '$in_errstr'\r\n", 3, LOGFILE_PATH);

My guess is that LOGFILE_PATH isn't set correctly which is set earlier as  
define('LOGFILE_PATH', '../../logs/tbwe_log.log');

***Second error:
This error doesn't display a line number, but there is a call that  
references *error.php* that displays an error page. The file is in the doc  
root, it is not in the /includes/ folder where the application is looking  
for it. This is the call:

header('Location: ../error.php?err=' . $in_errno);

*** Apache relevant configuration:

DocumentRoot "C:/Web/Tbwe"

<Directory "C:/Web/Tbwe">
    Options Indexes FollowSymLinks
    Options +Includes
    Options +IncludesNoExec
    AllowOverride Limit
    Order allow,deny
    Allow from all

*** PHP relevant configuration:

doc_root ="C:\Web\Tbwe"
include_path=".;C:\Program Files\PHP\pear"
include_path = ".;c:\Web\Tbwe"

Any help is greatly appreciated.

-- Bill

Re: Relative addressing issue.

Correction, the following command:
    header('Location: ../error.php?err=' . $in_errno
Should have been:
   header('Location: error.php?err=' . $in_errno

Appending the ../ was just something I was trying. Thanks.

Quoted text here. Click to load it

Re: Relative addressing issue.


Quoted text here. Click to load it

It's still wrong. The URL must be absolute.


Site Timeline