|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19323 Filesystem calls with relative paths don't work
Submitted: 2002-09-09 17:42 UTC Modified: 2002-09-19 11:28 UTC
Avg. Score:4.5 ± 1.0
Reproduced:10 of 11 (90.9%)
Same Version:8 (80.0%)
Same OS:6 (60.0%)
From: jneil at myersinternet dot com Assigned:
Status: Closed Package: Apache2 related
PHP Version: 4.2.3 OS: Linux
Private report: No CVE-ID:
 [2002-09-09 17:42 UTC] jneil at myersinternet dot com
As of PHP 4.2.3 any filesystem functions that call for a pathname only work with fully qualified paths.  Relative paths no longer appear to work.  This includes the fopen commands.  This breaks a lot of code out there.  For example, the following function does not work:

if ($fp = fopen("some_local_file.txt", "r")) {
  echo "Opened file...<br>\n\n";

However, the following DOES work:

if ($fp = fopen("/full/path/to/some_local_file.txt", "r")) {
  echo "Opened file...<br>\n\n";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-09 18:03 UTC]
Works fine here. Does it work with PHP 4.2.2?
 [2002-09-09 18:05 UTC] jneil at myersinternet dot com
It did work with 4.2.2.  Are their config options introduced with 4.2.3 that changed this behavior?  We did not change our php.ini file when we upgraded from 4.2.2 to 4.2.3.
 [2002-09-10 05:24 UTC]
Are you using Apache2?
 [2002-09-10 10:31 UTC] jneil at myersinternet dot com
I am using apache2 running php as an SO module.
 [2002-09-11 02:15 UTC] florian at cathala dot org
Same problem on FreeBSD 4.6-STABLE with Apache 2.0.40 and PHP 4.2.3.

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/usr/local' '--with-sockets' '--enable-ftp' '--with-gd' '--with-gettext' '--with-ttf' '-with-pdflib' '--with-png' '--with-tsrm-pth' '--with-pgsql'
 [2002-09-16 16:18 UTC] bjr at dexel dot dk
Same problem on apache2.0.40 and php 4.2.3/linux 2.4.18-3 - rather annoying
 [2002-09-17 13:59 UTC] florian at cathala dot org
Please fix, that's really annoying.
 [2002-09-18 02:04 UTC] svupp at hotmail dot com
I have to add my support to a fix here... Got one of my PHP applications up and running, but others will require quite a lot fo work if I have to make ALL pathnames FQ...

 [2002-09-18 06:23 UTC] sunkan_ at hotmail dot com
Is this a duplicate of #19287 ?
 [2002-09-18 08:35 UTC] svupp at hotmail dot com
Seems so! I upgraded to latest stable release, as noted in . And everything is now working again!

 [2002-09-19 11:28 UTC] jneil at myersinternet dot com
Unfortunately the latest php4-STABLE-latest.tar.gz won't compile the imap extension (because of a misspelled variable name on line 2312 of php_imap.c).  While I can correct that error and compile the file I'm not happy about using something called a "STABLE" release that has such an obvious problem.
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 04:01:42 2015 UTC