visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: chmod via ftp


By: PHP newbee U.S.A.  Date: 05/02/2003 00:00:00  English  Points: 200 Status: Answered
Quality : Excellent
hi,

i tried to change the right for a via ftp created directory also via an ftp command. i tried the following:

ftp_exec($conn_id, "SITE CHMOD 713 direcoty");

and

ftp_exec($conn_id, "CHMOD 713 direcoty");

i'm getting a warning that the ftp_exec() is not recognized. i cannot use the usual chmod() command because then the rights will be changed for the user "www" or "nobody" or whatever as owner...

so maybe some of you have expirience with an php command to chmod a directory via ftp. THANKS!!
By: VGR Date: 06/02/2003 07:33:00 English  Type : Answer
it means that ftp_exec() function is not available in your server. It wasn't compiled with it.

Anyway, I don't fond ftp_exec() in my PHP documentation 8-)))))

Table of Contents
ftp_connect -- Opens up an FTP connection
ftp_login -- Logs in an FTP connection
ftp_pwd -- Returns the current directory name
ftp_cdup -- Changes to the parent directory
ftp_chdir -- Changes directories on a FTP server
ftp_mkdir -- Creates a directory
ftp_rmdir -- Removes a directory
ftp_nlist -- Returns a list of files in the given directory.
ftp_rawlist -- Returns a detailed list of files in the given directory.
ftp_systype -- Returns the system type identifier of the remote FTP server.
ftp_pasv -- Turns passive mode on or off.
ftp_get -- Downloads a file from the FTP server.
ftp_fget -- Downloads a file from the FTP server and saves to an open file.
ftp_put -- Uploads a file to the FTP server.
ftp_fput -- Uploads from an open file to the FTP server.
ftp_size -- Returns the size of the given file.
ftp_mdtm -- Returns the last modified time of the given file.
ftp_rename -- Renames a file on the ftp server.
ftp_delete -- Deletes a file on the ftp server.
ftp_site -- Sends a SITE command to the server.
ftp_quit -- Closes an FTP connection

I think it should be ftp_site("chmod 713 directory") but you clearly depend on the distant FTP server's ability to process that command.

I think it will not work on all the server's of the world

Good luck.
By: RQuadling Date: 07/02/2003 22:46:00 English  Type : Assist
$upload = ftp_put($conn_id, "/home/to/public_html/index.php", $source_file, FTP_ASCII);
$ch=@ftp_site($conn_id,"chmod 755 /home/to/public_html/index.php");

As VGR says, but note the the return value from ftp_site is a boolean. So you have to try the command and see if it worked.

Not great.

Richard.

Do register to be able to answer

EContact
browser fav
page generated in 218.594070 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page