Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create folder on another domain 1

Status
Not open for further replies.

tektipsismyfavorite

Technical User
May 4, 2006
57
US
I have a subdomain with the same company and if I ftp into my host, all my domains/subdomains are listed in the same directory. So i figured i can use:

mkdir("../../../sub.domain.com/files/".$directory,0777);
(where "../../../" gets me out of the current folder and into the one above the root folder of "domain.com"

I don't think that is working.

So, I tried:
Code:
$server = "ftp.domain.com";
$connection = ftp_connect($server);
$result = ftp_login($connection, $user, $pass);

ftp_site($connection, "CHMOD 777 sub.domain.com/files/$directory") or die("FTP SITE CHMOD failed.");
ftp_close($connection);

I also tried MKDIR where CHMOD is and that didn't work either. Any ideas?
 
you need to use ftp_mkdir not mkdir

just use
Code:
ftp_mkdir($connection, $dirtocreate);

i may be wrong here, but i don't think you can use ftp_chmod on a directory. it changes file permissions.
 
When a web server runs a PHP script, that script is run with the permissions of the user as which the web server runs. That user likely does not have permission to create directories, which is probably causing the problem with our first example code.



As for the FTP code goes, you can work around the permissions problem. But a lot of FTP servers at hosting providers have all the SITE functionality turned off. Have you tried ftp_mkdir() and ftp_chmod()?



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top