php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 + 20 = ?
Subscribe to this entry?

 
 [2006-11-19 10:18 UTC] freidman at mail dot ru
Description:
------------
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:
---------------
<?php
putenv('TMPDIR=/hosting/clients/xxx.com/httpd/tmp');

echo getenv('TMPDIR');

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

// 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
ftp_close($conn_id);

// output the buffer
var_dump($buff);
?>

Expected result:
----------------
listing of files

Actual result:
--------------
/hosting/clients/xxx.com/httpd/tmp
Warning: ftp_rawlist() [function.ftp-rawlist]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/hosting/clients/xxx.com/httpd:/usr/lib/php:/usr/local/lib/php) in /hosting/clients/xxx.com/httpd/htdocs/a.php on line 15

Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create temporary file. Check permissions in temporary files directory. in /hosting/clients/xxx.com/httpd/htdocs/a.php on line 15
bool(false) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

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] tony2001@php.net
>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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC