Solved

Uploading through php blocked?

Posted on 2007-03-29
1
262 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 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 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