|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39555 ftp_rawlist not work with open_basedir
Submitted: 2006-11-19 10:18 UTC Modified: 2006-11-20 16:25 UTC
From: freidman at mail dot ru Assigned:
Status: Not a bug Package: FTP related
PHP Version: 5.2.0 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2006-11-19 10:18 UTC] freidman at mail dot ru
This is related to bug #32708

There must be a way to set tmp-file creation of this functions, but setting TMPDIR environment variable doesn't work. I don't want to include /tmp dir in open_basedir directories.

Reproduce code:

echo getenv('TMPDIR');

// set up basic connection
$conn_id = ftp_connect("");

// login with username and password
$login_result = ftp_login($conn_id, "xxx", "xxx");

// get the file list for /
$buff = ftp_rawlist($conn_id, '/');

// close the connection

// output the buffer

Expected result:
listing of files

Actual result:
Warning: ftp_rawlist() [function.ftp-rawlist]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/hosting/clients/ in /hosting/clients/ on line 15

Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create temporary file. Check permissions in temporary files directory. in /hosting/clients/ on line 15


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-19 17:01 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

In order to use tmp directory with open_basedir the directory 
must be part of the open_basedir directive.
 [2006-11-20 16:03 UTC] freidman at mail dot ru
ftp_rawlist must create temporary file in directory which is set in environment variable TMPDIR, but it doesn't. It is always created in /tmp directory, that is wrong. I understand that temporary directory must be in open_basedir directive, but I want to specify temporary directory to use.
 [2006-11-20 16:04 UTC] freidman at mail dot ru
Changed the state to Open
 [2006-11-20 16:25 UTC]
>ftp_rawlist must create temporary file in directory which
> is set in environment variable TMPDIR, but it doesn't.

No, it was never supposed to work this way.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri May 27 18:06:15 2022 UTC