Bug #60143 [Opn->Csd]: ftp_nlist does not return anything.
| From: | cdburgess at gmail dot com | Date: | Fri, 28 Oct 2011 15:33:07 +0000 |
| Subject: | Bug #60143 [Opn->Csd]: ftp_nlist does not return anything. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164639@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60143&edit=1
ID: 60143
User updated by: cdburgess at gmail dot com
Reported by: cdburgess at gmail dot com
Summary: ftp_nlist does not return anything.
-Status: Open
+Status: Closed
Type: Bug
Package: FTP related
Operating System: Mac OS X 10.7.2
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
Resolved. Was an issue regarding the environment variable location of the TMPDIR pointing to a
location that was not writable.
Previous Comments:
------------------------------------------------------------------------
[2011-10-28 15:32:21] cdburgess at gmail dot com
Found the problem. This is similar to: https://bugs.php.net/bug.php?id=28865
To solve do the following:
add this to the php script:
var_dump(getenv(TMPDIR)); exit;
Mine returned a strange tmp dir location or /var/folders
Then I did:
sudo chmod -R 0777 /var/folders
Now it works as expected!
------------------------------------------------------------------------
[2011-10-27 02:31:08] cdburgess at gmail dot com
I tried rebooting my machine in 32 bit mode, and I can get the command line version of this script
to work. It still will not work in the browser so I am looking into that. But it definitely appears
to be a 64 bit issue.
------------------------------------------------------------------------
[2011-10-26 22:52:57] cdburgess at gmail dot com
Just tested this on another Mac OS X 10.6.8 running PHP v 5.3.4 and the function works just fine.
This could have something to do with Lion (x86_64) based machines.
------------------------------------------------------------------------
[2011-10-26 17:37:55] cdburgess at gmail dot com
Description:
------------
When running this script on a linux box, it works as expected. CURLOPT_FTPLISTONLY will work as
well. However, when trying to run this from a Mac, it does not return anything.
Test script:
---------------
<?php
$ftp_server = 'DOMAIN';
$ftp_user_name = 'USER';
$ftp_user_pass = 'PASS';
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
ftp_pasv($conn_id, true);
ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$dir = ftp_pwd($conn_id);
$list = ftp_nlist($conn_id, $dir);
print_r($list);
ftp_close($conn_id);
?>
Expected result:
----------------
I would expect to see a list of files location on the FTP server.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60143&edit=1