I use Current PHP version: 7.1.4
for Ionic2
application back-end.
I'm trying to create folder on my ftp server
. With direct link to php file http://site/php/directory.php
echo is
Successfully created images
After this, folder images
does not exist in directory, and with second link to php, message is:
Warning: ftp_mkdir(): Can't create directory: File exists in /path/php/directory.php on line 8 Error while creating images
but folder images
was not created and does not exist in directory. Then I've manually created a folder images
with FTP client tool, this way folder was really created as usually.
Why with first link to http://site/php/directory.php
echo was Successfully created images
and with second Can't create directory: File exists in
if folder images
was not created, and after this, also I was able to create the folder images
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:
<?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);
?>
The folder was created but on a different location. You have to look up where your php code is actually executed and then you will find the wrongly created folder.
From my point of view: its quite tricky to define where such a folder or file gets created. There are however "show working directory" commands which will help you out debugging this.