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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.