Edit report at https://bugs.php.net/bug.php?id=60143&edit=1
ID: 60143 Comment by: cdburgess at gmail dot com Reported by: cdburgess at gmail dot com Summary: ftp_nlist does not return anything. Status: Open 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: 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! Previous Comments: ------------------------------------------------------------------------ [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