S
S
Symbi0t2014-08-06 13:35:56
PHP
Symbi0t, 2014-08-06 13:35:56

Strange behavior of php functions ftp_nlist and ftp_rawlist. What could be the problem?

Greetings!
More than once I had to use the above voiced functions, while there were no problems. Both functions returned a list of files. But with the transition to a new hosting, the following problems appeared:
(The version of php used is 5.5.13 )
The ftp_nlist() function returns the name of the root directory anyway.

$contents = ftp_nlist($conn_id, ".");

var_dump($contents);

Returns:
Array
(
    [0] => 134.255.229.133_28000
)

This is the name of the root directory. Next, I pass this name to the function:
$contents = ftp_nlist($conn_id, "134.255.229.133_28000");

And again I get exactly the same result.
Then I tried to use the ftp_rawlist() function .
$contents = ftp_rawlist($conn_id, "134.255.229.133_28000");

It returned a result, but somewhat strange, i.e., not of this kind:
array(3) {
  [0]=>
  string(65) "drwxr-x---   3 vincent  vincent      4096 Jul 12 12:16 public_ftp"
  [1]=>
  string(66) "drwxr-x---  15 vincent  vincent      4096 Nov  3 21:31 public_html"
}

And here it is (with this formatting):
Array
(
    [0] => 06-16-14  07:22PM       
               dir_name_1
                     [1] => 06-24-14 04:50PM
                                  dir_name_2
                            [2] => 07-31-14 02:37PM
                                         dir_name_3
                                   [3] => 06-16-14 07:30PM
                                               dir_name_4
                                         [4] => 07-31-14 05:27PM
                                                    dir_name_5
)

First, there is no permission information ( drwxr-x--- ).
Secondly, information about each directory is returned with a large number of spaces.
Tell me, please, what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DeFacto, 2014-08-12
@DeFacto

Try like this:
ftp_rawlist($h, '-1l /');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question