Solved

Uploading through php blocked?

Posted on 2007-03-29
1
260 Views
Last Modified: 2010-08-05
I'm working on a server now which sets all my uploaded files (uploaded through php) at 600 permissions. chmod doesn't work, umask doesn't either. I also can't change permissions through ftp. I can make directories through php and those get 755 permissions but if I then upload a file in that directory (which should have the same owner?) it gets 600 permissions and I seem to be unable to change it. The only way uploading works is if I upload via ftp but I'm making a website which requires uploading through a form.

Can it be that my provider has blocked this somehow? The provider has a CMS system available for me which uses chmod and umask which does work but since I need to do something the CMS system can't do that's not an option.

Could chmod and umask be blocked only for specific directories? Can I check this somehow without having access to php.ini file?
0
Comment
Question by:bt33
1 Comment
 
LVL 50

Accepted Solution

by:
Steve Bink earned 250 total points
ID: 18818339
My research implies your problem is due to safe mode.  Please see this page for the references:

http://www.php.net/manual/en/features.safe-mode.functions.php

When PHP creates a file, it is created by the UID/GID assigned to the web server, usually apache or httpd.  When safe mode is engaged, PHP will check to make sure the UID owning the file is the same as the UID requesting the mode change.  If it is not, chmod() will fail.

One workaround I've seen for this is to use the FTP functions within PHP.  Check out ftp_chmod():

http://www.php.net/manual/en/function.ftp-chmod.php
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question