Page 1 of 1
newbie question - i've searched everywhere for the answer
Posted: Wed Apr 09, 2003 3:22 am
by dybenko
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!
Posted: Wed Apr 09, 2003 3:31 am
by m3mn0n
Posted: Wed Apr 09, 2003 4:06 am
by dybenko
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...
Posted: Wed Apr 09, 2003 4:23 am
by m3mn0n
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...
hehe, if you put any php in a txt file it would be just text.
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.

It's only when i transfer to Linux, i get errors.
This should do the trick...
Code: Select all
<?php
chmod ("entry.txt", 0766);
?>
Posted: Wed Apr 09, 2003 4:42 am
by twigletmac
Have you tried running the scripts locally - on Windows it is unlikely that you would have to set any permissions.
Mac
Posted: Wed Apr 09, 2003 4:46 am
by dybenko
I'm sorry if i sound really really dumb, but for some reason it's not working for me...
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,
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...
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?

Posted: Wed Apr 09, 2003 4:54 am
by m3mn0n
check your private messages.

Posted: Wed Apr 09, 2003 6:31 am
by DeGauss
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.