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
Solved

Uploading through php blocked?

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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…
The viewer will learn how to dynamically set the form action using jQuery.

856 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