title: Create folder on FTP server with PHP
body: <p>I use <code>Current PHP version: 7.1.4</code> for <code>Ionic2</code> application back-end.</p>
  
  <p>I'm trying to create folder on my <code>ftp server</code>. With direct link to php file <code>http://site/php/directory.php</code> echo is </p>
  
  <blockquote>
    <p>Successfully created images</p>
  </blockquote>
  
  <p>After this, folder <code>images</code> does not exist in directory, and with second link to php, message is:</p>
  
  <blockquote>
    <p>Warning: ftp_mkdir(): Can't create directory: File exists in
    /path/php/directory.php on line 8 Error while creating images</p>
  </blockquote>
  
  <p>but folder <code>images</code> was not created and does not exist in directory. Then I've manually created a folder <code>images</code> with FTP client tool, this way folder was really created as usually.</p>
  
  <p>Why with first link to <code>http://site/php/directory.php</code> echo was  <code>Successfully created images</code> and with second  <code>Can't create directory: File exists in</code> if folder <code>images</code> was not created, and after this, also I was able to create the folder <code>images</code> manually. I'm not sure, maybe it is some specific default server setting, or some kind of hidden folder. I do not have hidden files there, so no idea what is wrong here:</p>
  
  <pre><code>&lt;?php
  $ftp_server = "ftp_address";
  $ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
  $login = ftp_login($ftp_conn, "ftp_username", "ftp_password");
  
  $dir = "images";
  
  if (ftp_mkdir($ftp_conn, $dir))
    {
    echo "Successfully created $dir";
    }
  else
    {
    echo "Error while creating $dir";
    }
  ftp_close($ftp_conn);
  ?&gt; 
  </code></pre>