php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60143 ftp_nlist does not return anything.
Submitted: 2011-10-26 17:37 UTC Modified: 2011-10-28 15:33 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: cdburgess at gmail dot com Assigned:
Status: Closed Package: FTP related
PHP Version: 5.3.8 OS: Mac OS X 10.7.2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cdburgess at gmail dot com
New email:
PHP Version: OS:

 

 [2011-10-26 17:37 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-26 22:52 UTC] 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-27 02:31 UTC] 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-28 15:32 UTC] 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-28 15:33 UTC] cdburgess at gmail dot com
Resolved. Was an issue regarding the environment variable location of the TMPDIR pointing to a location that was not writable.
 [2011-10-28 15:33 UTC] cdburgess at gmail dot com
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC