The most common reason you will need to change the CHMOD of a file or folder in PHP is to write data to a folder (image uploads for example) or a file (such as a flat file database.) This is a very easy process that you can do though most FTP programs. Although the screenshot in this article is from the FTP program Transmit, most FTP programs work in a similar way so the same steps and concepts will apply.
Time Required: 2 mins
- Open up your FTP program and connect to your website.
- Find the file or folder that you need to CHMOD, and right click it (apple-click if you have a Mac)
- Look for an option called "Get Info" or "More Info" or "CHMOD". The wording will vary by programs. You may have to try a couple different options if you aren't sure.
- If you are in the right area, a window with permissions will come up. This usually consists of several check boxes, 3 labeled "Read", 3 labeled "Write" and 3 labeled "Execute". From here you can check and uncheck the boxes for the User, Group and World, thus changing the CHMOD. Often for your convince there is a text input box were you can just type in the CHMOD if you know it, "755" for example, and the correct boxes will check.
- If the window has a button such as "Apply" or "Submit" or "Save" be sure to click it so that your changes are made.
- Be sure you know what permissions a file needs, so you do not give unneeded access to files.
- When you CHMOD a file, some servers require you also CHMOD the folder holding it to the same level of access for it to work.
What You Need
- An FTP Program and your FTP login
- A file or folder whos permissions you wish to change