Solved

Uploading through php blocked?

Posted on 2007-03-29
1
256 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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Connect to MS-SQL server from Linux/PHP 8 60
Responsive Design Tools 6 36
PHP Startup Error 12 29
session dropped in IE 10 19
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now