Jump to content


chmod() not working

  • Please log in to reply
2 replies to this topic

#1 trillion

  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 15 September 2006 - 09:48 PM

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

and I get this:

Fatal error: Call to undefined function: ftp_chmod() in /home/inherent/public_html/Promote Musicians/codibot.php on line 47

#2 trillion

  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 16 September 2006 - 03:31 AM

I go chmod to work on files for both local server and remote server however I still need to find a script to chmod directories

any sources will help


#3 AndyB

  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 16 September 2006 - 03:36 AM

Legend has it that reading the manual never killed anyone.
My site

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users