CHMOD Questions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
supercabbage
Forum Newbie
Posts: 3
Joined: Sun Aug 06, 2006 5:46 am

CHMOD Questions

Post by supercabbage »

Hello, i recently bought some hosting and it's not the best. I can't CHMOD using FTP Software as i get the following error whenever i try to CHMOD anything.
500 'SITE CHMOD 666 db.txt': command not understood
I was talking to my host who said they are "working on it" but in the mean time i should use PHP to get the job done. Well it's been a few weeks since he said he was working on it so i guess it's not happening any time soon.

I was reading on PHP.net about the CHMOD function which i tried, the chmod.php file i made didn't show up any errors (blank white page) but the files do not seem to have the correcrt CHMOD value. Basicaly how can i ensure that the files are actually being CHMODed. Also is the following code the "right" code for the job?

Code: Select all

<?php
chmod("tagbox/db.txt", 0666);
chmod("tagbox/online.txt", 0666);
?>
Is there any other way to do this without using PHP? I personaly think it's ridiculous that i'm paying for a service where i can't even CHMOD using bog-standard FTP software. Oh, and by the way the file (CHMOD.php) is in the same directory as index.php and links to two files in a tagbox directory.

I'm a newbie when it comes to PHP so if you could break it down into simple terms that would be great :wink:. Any help would be much appreciated.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Hmm, that PHP code looks good to me. Try this to see if they are actually being chmod()'d.

Code: Select all

if(chmod('somefile.txt', 0666))
   echo 'Yay, it works!';
else
   echo 'Boo, no worky. ';
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
supercabbage
Forum Newbie
Posts: 3
Joined: Sun Aug 06, 2006 5:46 am

Post by supercabbage »

Many thanks. I was able to verify whether or not the CHMOD commands were working and put the problem down to the script, not the chmod value. Thank you!
Post Reply