Jump to content

chmod() not working


trillion

Recommended Posts


I can get this to work on files but not directories on my local server. Then it doesn't even work on files when I upload it to a remote server. I have not had success at all with the ftp method but I have been successful with other PHP/ftp functions.

What do I need to do different?
my code looks something like this:


chmod(/home/user/public_html/file.php, 0666);

and I get this:

Warning: chmod(): Operation not permitted in /home/user/public_html/chmod.php on line #


I also have tried this:

$ftp_user_name = "user";
$ftp_user_pass = "pass";
$ftp_server = "localhost";
$file = 'public_html/file.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 666
if (ftp_chmod($conn_id, 0666, $file) !== false) {
echo "$file chmoded successfully to 666\n";
} else {
echo "could not chmod $file\n";
}

// close the connection
ftp_close($conn_id);



and I get this:

Fatal error: Call to undefined function: ftp_chmod() in /home/inherent/public_html/Promote Musicians/codibot.php on line 47
Link to comment
https://forums.phpfreaks.com/topic/20925-chmod-not-working/
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.