Jump to content


php chmod and ftp problem

  • Please log in to reply
1 reply to this topic

#1 mr666

  • Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 July 2006 - 07:56 AM

im using mkdir and chmod to create dir, copy files into the created dir and to chmod it (anything but 777).. like:

    if(!is_dir("$ausername")) {
        mkdir("$ausername", 0755);
        @chmod("$ausername", 0755);
        copy("stu_index.html", "$ausername/index.html");
        @chmod("$ausername/index.html", 0755);

*the problem is i cant add files via ftp to the created folder or even delete it..

    if(!is_dir("$ausername")) {
        mkdir("$ausername", 0777);
        @chmod("$ausername", 0777);
        copy("stu_index.html", "$ausername/index.html");
        @chmod("$ausername/index.html", 0777);

*only when i use php to mkdir and chmod it to 777, then i am able to add files and or del the folder via ftp..

i wonder how can i not chmod the file and folder 777 yet able to edit things via ftp ? im using a shared unix host..

thanks in advance!

#2 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 05 July 2006 - 11:52 AM

mkdir and chmod are only effective for the PHP script. It wont set the permission for the folder/file forever

If you want to ftp stuff to the folder you can do by logging in to your FTP client, going to the folder, right click it and select properties or change permissions. You sholud be able to change the permissions for the file/folder. If not your host may have disabled this or the server is a Windows server and doesnt support CHMOD permissions.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users