?
Solved

Uploading through php blocked?

Posted on 2007-03-29
1
Medium Priority
?
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 51

Accepted Solution

by:
Steve Bink earned 1000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

771 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