Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
fwrite without making folder CHMOD 777?
Old 08-03-2009, 10:02 AM fwrite without making folder CHMOD 777?
Novice Talker

Posts: 9
Trades: 0
Hi guys,

Is it possible to use fopen/fwrite functions without making the targetfolder CHMOD 777?

I have read several times across the internet that one should avoid using 777 because of the danger of attacks. So is there a way to avoid it, and still have php create and write to a file?

Thanks.

Kind regards
Chrisper
chrisper is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-03-2009, 11:07 AM Re: fwrite without making folder CHMOD 777?
Novice Talker

Posts: 13
Trades: 0
Yes, if you run php as FastCGI which allows you to run php as a user different from "nobody". Then simply make the user the owner of that directory.

(Not as simple as it sounds, ask your host)
premiumscripts is offline
Reply With Quote
View Public Profile
 
Old 08-04-2009, 03:31 AM Re: fwrite without making folder CHMOD 777?
nayes84's Avatar
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
Having phpsuexec enabled will fix the problem
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

if(I'm("Helpful")) Add_Talkupation("nayes84");
nayes84 is offline
Reply With Quote
View Public Profile
 
Old 08-05-2009, 04:15 AM Re: fwrite without making folder CHMOD 777?
Novice Talker

Posts: 9
Trades: 0
Thanks guys.
I wrote to my webhost, and they said that we run cgi. But they also said that it runs with our own usercredentials, so we should be able to edit the files with chmod 700. But I am not... The least I need is, as I have tested, 002 (write permission for public). And that is for writing to an existing file. First I need to create the file, which I cannot at the moment do without chmodding the whole directory to 777.

Is there some way I can set up the php script so that I am seen as the user/owner?
chrisper is offline
Reply With Quote
View Public Profile
 
Old 08-06-2009, 09:12 AM Re: fwrite without making folder CHMOD 777?
Novice Talker

Posts: 9
Trades: 0
Okay. Together with my webhost we found the solution:

Turns out that the ftp user we are using for the domain is not set as the Owner/Group of the folders. So after we changed this, the php script is able to create and edit the files.
chrisper is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to fwrite without making folder CHMOD 777?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15019 seconds with 12 queries