Hi,
I installed php 4and an apache server and they are working fine - i've executed some very simple scripts with success.
I have tried downloading a few guest book scripts and they all tell me to use chmod to set the permission levels to 766 or 666 etc...
I am using Windows XP and I want to experiment with the files on my hard drive without uploading them using ftp.
How do I set the permissions in windows? All of these "simple" scripts are not working because I cannot change the permission levels.
Any help would be GREATLY appreciated!
Thank you in advance!
newbie question - i've searched everywhere for the answer
Moderator: General Moderators
Thanks for your response - I have seen the chmod function before, but I guess I should have been more specific.
The guestbook scripts I'm using write to a text file called: entry.txt
The readme file for the scripts says: "NOTE you MUST change the CHMOD levels on the entry.txt file to 766 otherwise the .PHP file wont write to the text file and you will get an error."
So I guess I'm asking where do I put the chmod function call? In the txt file itself or in the php files that write to the txt file...
And... if it were a simple line of code why isn't it already included in the files themselves??
PS I'm using dreamweaver MX... not sure if that helps...
The guestbook scripts I'm using write to a text file called: entry.txt
The readme file for the scripts says: "NOTE you MUST change the CHMOD levels on the entry.txt file to 766 otherwise the .PHP file wont write to the text file and you will get an error."
So I guess I'm asking where do I put the chmod function call? In the txt file itself or in the php files that write to the txt file...
And... if it were a simple line of code why isn't it already included in the files themselves??
PS I'm using dreamweaver MX... not sure if that helps...
hehe, if you put any php in a txt file it would be just text.dybenko wrote: So I guess I'm asking where do I put the chmod function call? In the txt file itself or in the php files that write to the txt file...
With chmod settings it goes, once you make a setting change, it should stay that way unless it is changed again. There is no default setting that it goes back to once you use chmod() so if you create a brand new php file on your server, and do the chmod() changing, then it will work for you, and stay that way unless you choose otherwise.
Though i develop on a windows server, all my accual work is published on Linux servers and the setup it pretty much the same. But, come to think of it i've never really set any special settings for my txt files when they are being written too.
This should do the trick...
Code: Select all
<?php
chmod ("entry.txt", 0766);
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
I'm sorry if i sound really really dumb, but for some reason it's not working for me...
When you say "php file on your server" do you mean my apache server on my computer? All of these files are viewed using my apache server with my IP address... do I need to create a php file that is in the main apache directory?

OK so I tried this code in all of the php files that go with the address book, I also tried making a separate php file that only contained that code, but it still isn't working for some reason...There is no default setting that it goes back to once you use chmod() so if you create a brand new php file on your server,
When you say "php file on your server" do you mean my apache server on my computer? All of these files are viewed using my apache server with my IP address... do I need to create a php file that is in the main apache directory?
Your computer is a server. It hosts PHP and Apache (which are also servers, but when anyone mentions a server, they probably mean the machine the software is running on).
Anyway.
if you're using windows, Then you can set the properties of the txt file by right clicking the file and choosing permissions for anyone to modify the file (not sure about this right now, as i'm a bit fuzzy on windows).
*nix is a different story. If you have shell access to your server, you would type at your command prompt "chmod 766 entry.txt".
If you don't have shell access, simply write a php script like the following:
The backticks essentially tell PHP to execute anything in between them to be executed by the system rather than php.
Anyway.
if you're using windows, Then you can set the properties of the txt file by right clicking the file and choosing permissions for anyone to modify the file (not sure about this right now, as i'm a bit fuzzy on windows).
*nix is a different story. If you have shell access to your server, you would type at your command prompt "chmod 766 entry.txt".
If you don't have shell access, simply write a php script like the following:
Code: Select all
<?php
`chmod 766 entry.txt`;
?>