Jump to content

CHMOD


tcorbeil

Recommended Posts

Hey fert..

 

you lost me..  can you clarify?

 

I have the following 3 lines in my script to which the 2 first ones work perfectly..

 

!ftp_chdir($connection, $currentdir);

!ftp_mkdir($connection,$Subpage) ;

!ftp_chmod($connection, 777, $Subpage);

 

So basically, go to a specific directory, make a new directory and then make the new directory CHMOD 777.

 

Any further input would be appreciated..

T.

Link to comment
https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213178
Share on other sites

Ok, sorry for the bother..  I got it...

 

add this to the beginning of the script to create function..

 

if (!function_exists('ftp_chmod')) {

  function ftp_chmod($ftp_stream, $mode, $filename)

  {

      return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename));

  }

}

 

Link to comment
https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213200
Share on other sites

<?php

$file = 'public_html/index.php';

 

// set up basic connection

$conn_id = ftp_connect($ftp_server);

 

// login with username and password

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

 

// try to chmod $file to 644

if (ftp_chmod($conn_id, 0644, $file) !== false) {

echo "$file chmoded successfully to 644\n";

} else {

echo "could not chmod $file\n";

}

 

// close the connection

ftp_close($conn_id);

?>

Link to comment
https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213284
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.