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
php creates file owned by 80, ftp can't access it
Old 09-17-2005, 12:52 PM php creates file owned by 80, ftp can't access it
Junior Talker

Posts: 3
Trades: 0
PHP, Apache, file permissions or settings question.

I have a PHP file management script that creates directories and files within the directory.

Script works - it creates the files. I just can't do anything with them once they are there.

Works on one hosting company, not on another. Shared, Linux, Apache.

For the one that does not work, the owner ends up as 80 (or www), and cannot be deleted by ftp or have files added to it by ftp (wsftp).

For the one that works, it has owner thats my login.

Owner is provided by PHP function posix_getpwuid.

Technical question for y'all. What do I want to search on to understand the server setup? What is the magic incantation that controls those settings in either Apache, the OS or in PHP.

One company works, the other does not. Don't know if it's OK to name companies here. Both are big hosting companies.

I want to understand what is going on so I can ask the right questions, and fix it if I need to. Would hate to wake up one morning and find my code not working - and not even have the right questions to ask. I have a 3-day old ticket on this question for the one that does not work, and a 7 day old ticket for yet another hosting company. I have a little test script I set up so that I can check out functionality before adding the mysql and all the other code.

I'm using mkdir to create the directory, and fopen to create the files, so there is nothing special about it.

Suggestions welcome. Educamate me.

Thanks. Don (chicos tacos)
chicos tacos is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-17-2005, 02:37 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
This is a tough one that I have run into myself, however I do not personaly know the solution, I do know that one exists. The template engine Smarty does not seem to have this problem so I assume they have worked it out (with their caching mechanism) you may want to examine their code.
__________________

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
Republikin is offline
Reply With Quote
View Public Profile
 
Old 09-18-2005, 12:16 AM
nick89's Avatar
Super Talker

Posts: 136
Location: Brisbane, Australia
Trades: 0
su
chown
chmod

If you have SSH access those are the steps you should take.
nick89 is offline
Reply With Quote
View Public Profile Visit nick89's homepage!
 
Old 09-18-2005, 10:43 AM
Junior Talker

Posts: 3
Trades: 0
Thanks for the moral support.

What server settings are involved that affect who a script runs as?

The only reference I've found is in some info from www.modwest.com/php (they say they solve this problem for their hosting). I have not used them, but it looks like a dead ringer for the issue that I have.

Here is their blurb:
<code>
Context Consistency Explained
Web developers typically interact with their website files in three distinct ways, or contexts.

File upload/download (FTP or SCP)
Command line (telnet or SSH)
Web browser
The problem at many web hosts is that each of these contexts has its own set of rules. These rule mismatches at the very least create confusion, but can also complicate the development process or even degrade security.
For example, files created via FTP or SSH may be owned by the developer's user account (or UID), but files created by website PHP scripts are owned by a different UID, such as "apache", "nobody", or "www-data". As a result, either you cannot remove and edit files created by your scripts, or your script cannot create data files at all. The most common error is "Permission denied", requiring knowledge and execution of Unix commands such as chmod and chown on a case-by-case basis. ...
</code>

I am 100% certain I am not searching for this with the right words, and look forward to a *nix admin to say "Don - all you have to do is ..."

Thanks for the suggestions so far.
chicos tacos is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to php creates file owned by 80, ftp can't access it
 

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.27239 seconds with 12 queries