php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5674 Relative paths don't work
Submitted: 2000-07-19 13:16 UTC Modified: 2000-12-13 16:03 UTC
From: amour at centras dot lt Assigned: zak (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.1pl2 OS: WinNT 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: amour at centras dot lt
New email:
PHP Version: OS:

 

 [2000-07-19 13:16 UTC] amour at centras dot lt
I don't know where the problem is. But the fact is that relative paths don't work on my server. I'm using IIS4 server. I use relative path in include() and fopen() functions. For example, include("_settings.php")... It's worked with PHP4.0.0! The php.ini files are identical! From both versions I'm using.

I'm using 4.0.1pl2 version of PHP. It's binary version downloaded from php.net...

I can send you my php.ini if the problem can be in it...

That's all for now. Bye

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-26 22:31 UTC] zak@php.net
Will analyze...
 [2000-08-06 00:10 UTC] zak@php.net
Please send me a copy of your php.ini file.
(zak@php.net)
 [2000-08-29 14:23 UTC] zak@php.net
Note from cynic@mail.cz:
"This bug seems to come and go. Relative paths worked for 
me with a two weeks old snapshot, and stopped working 
a week ago. It still doesn't work with php4-200008290145, 
unchanged php.ini-optimized. (Win32 Apache module with 
apache-1_3_20000825161201 snapshot.)"
 [2000-08-31 11:24 UTC] zak@php.net
More information from cynic@mail.cz

Hi. I found out relative paths work with 4.0.2 DSO on Apache 
1.3.12. And though I don't know the mechanism behind it, I 
found what has probably made the difference. 

As of 4 months ago win32 DSO PHP4 stopped building. The hack 
I was told to use was to delete everything but #include calls 
from <apache>/src/os/win32/readdir.h before building PHP. 
The original readdir.h from the 1.3.12 source looks like this: 


/*
 * Structures and types used to implement opendir/readdir/closedir
 * on Windows 95/NT.
 */
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#ifndef API_EXPORT
# define API_EXPORT(type)    __declspec(dllexport) type __stdcall
#endif
/* struct dirent - same as Unix */
struct dirent {
    long d_ino;                    /* inode (always 1 in WIN32) */
    off_t d_off;                /* offset to this dirent */
    unsigned short d_reclen;    /* length of d_name */
    char d_name[_MAX_FNAME+1];    /* filename (null terminated) */
};
/* typedef DIR - not the same as Unix */
typedef struct {
    long handle;                /* _findfirst/_findnext handle */
    short offset;                /* offset into directory */
    short finished;             /* 1 if there are not more files */
    struct _finddata_t fileinfo;  /* from _findfirst/_findnext */
    char *dir;                  /* the dir we are reading */
    struct dirent dent;         /* the dirent to return */
} DIR;
/* Function prototypes */
API_EXPORT(DIR *) opendir(const char *);
API_EXPORT(struct dirent *) readdir(DIR *);
API_EXPORT(int) closedir(DIR *);


which I trimmed to this: 


/*
 * Structures and types used to implement opendir/readdir/closedir
 * on Windows 95/NT.
 */
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>


With this readdir.h, relative paths work in 4.0.2 DSO. 
In the post 1.3.12 snapshot I tried (apache-1_3_20000825161201), 
readdir.h changed: 


/*
 * Structures and types used to implement opendir/readdir/closedir
 * on Windows 95/NT.
 */
#ifndef APACHE_READDIR_H
#define APACHE_READDIR_H
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#ifndef API_EXPORT
# define API_EXPORT(type)    __declspec(dllexport) type __stdcall
#endif
/* struct dirent - same as Unix */
struct dirent {
    long d_ino;                    /* inode (always 1 in WIN32) */
    off_t d_off;                /* offset to this dirent */
    unsigned short d_reclen;    /* length of d_name */
    char d_name[_MAX_FNAME+1];    /* filename (null terminated) */
};
/* typedef DIR - not the same as Unix */
typedef struct {
    long handle;                /* _findfirst/_findnext handle */
    short offset;                /* offset into directory */
    short finished;             /* 1 if there are not more files */
    struct _finddata_t fileinfo;  /* from _findfirst/_findnext */
    char *dir;                  /* the dir we are reading */
    struct dirent dent;         /* the dirent to return */
} DIR;
/* Function prototypes */
API_EXPORT(DIR *) opendir(const char *);
API_EXPORT(struct dirent *) readdir(DIR *);
API_EXPORT(int) closedir(DIR *);
#endif /* ndef APACHE_READDIR_H */


I cut this down to what's below, and relative paths didn't work 
anymore. I'm no C programmer, so this is probably all the help 
I can provide. Well, I can compile and test more snapshots if 
needed.  


/*
 * Structures and types used to implement opendir/readdir/closedir
 * on Windows 95/NT.
 */
#ifndef APACHE_READDIR_H
#define APACHE_READDIR_H
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#endif /* ndef APACHE_READDIR_H */


As for compile-time errors, both builds yielded just the usual 
bunch of benign macro redefinitions and maybe some signed/unsigned 
int comparisions. 


At 09:19 AM 8/30/00 -0600, Zak Greant wrote the following:
-------------------------------------------------------------- 
>At 03:05 PM 8/30/00 +0200, you wrote:
>>4.0.2 and latest CVS (php4-200008300445) on NT4 SP5 with
>>apache-1_3_20000825161201 still affected. Should I try it
>>with 1.3.12?
>
>Hi Cynic,
>
>If you have time, that would be great! :) I anticipate that you will get exactly the same results.
>
>- Zak
>
------end of quote------ 
 [2000-08-31 11:32 UTC] zak@php.net
Another Update from cynic:

Update: relative paths work on php4-200008310545 with 
apache-1.3_20000831101201. It's clear the problem was 
with the cut-down readdir.h. However, PHP still fails 
to build unless one comments out the definition of 
mode_t in %apachedir%/src/os/win32/os.h. Also, the 
abovementioned snapshot reports itself as 4.0.2 (no 
-dev suffix).
 [2000-12-13 16:03 UTC] zak@php.net
User reports that bug disappeared several versions ago.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 12:01:33 2025 UTC