Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP write permission

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I made a flash file, which passes variables to a php file.
This php file should write or modify a txt file(save the variables to the server).
It doesnt work and tells me, that i need a write permission to write to the server.
I have no idea what that means and how to get it,
please reply if u can help me.

Thanx
 
I once had the same problem - ask your ISP to grant your scripts the right to midify the file you wish. It may be you'll have to upload an initial (can be blank) file before doing so.

My provider gave me the rights within a day.
 
If you are a *nix server, then just chmod the .txt file to either 0644 or 0755. Either of those should work for reading and writing.


If that doesn't work, I suggest you takes Haslo's approach.


Hope this helps,
-Vic vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
 
If I have the permission which line should I write in my php file
 
Under Unix, the only users authorized to change permissions on a file, are root and the file owner...

If you're the owner of the file, you can change the first position to a 2, 6 or 7...

Examples:

chmod 200 <filename>
chmod 600 <filename>
chmod 700 <filename>

These first 3 examples give write permission to the owner of the file. The first example give write only, but not read... The second example gives read and write permission only... The third example gives read, write and execute permissions to the owner...

The second position in the above trinome indicates the permissions that you as the owner, are granting to all users belonging to the same group that you belong to...

The third position in the above trinome indicates the permissions that you as the owner, are granting to everyone in the world...

0 - No permission
1 - Execute only
2 - Write only
3 - Write and Execute only
4 - Read only
5 - Read and Execute only
6 - Read and Write only
7 - Read, Write and Execute

Normally, only 3 numbers are given...

If 4 numbers are given, the first number is called a &quot;sticky bit&quot;...

If the file is executable, the sticky bit indicates whether the file is executed as the owner, a group member, or someone else, not part of the group...

This has significant meaning, if a stranger is allowed access to your programs...
 
Unless you absolutely need the user who's executing the script to run it with the file owner's permissions, I would only use the 3-digit trinome...

If you only use the trinome, the default is to run the command with the permission of the person who's actually running the script...

If their permissions are restricted, then the program runs with the same restrictions...

It's a security issue...
 
Correction to my last post...

I'm pretty senior when it comes to Unix, but I'm just starting with PHP...

It seems that PHP almost requires that you use the full 4 numbers, or the chmod doesn't work as expected...

If you're changing permissions at the Unix level, you can use the trinome...

If you're changing permissions from within an HTML or PHP script, you'll need to use the 4th digit or sticky bit...

Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top