php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #25411 Change SAFE MODE behavior for new dirs or files
Submitted: 2003-09-07 06:49 UTC Modified: 2005-02-11 08:34 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: 4u at direct-netware dot de Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: Irrelevant OS: Linux in general
Private report: No CVE-ID: None
 [2003-09-07 06:49 UTC] 4u at direct-netware dot de
Description:
------------
Every time a script wants to create a directory and a file in it, it fails because of SAFE MODE restrictions (uid). Please note, that this is only true, if uid control is active.

Reproduce code:
---------------
<?php
mkdir ("mydir",0777);
$fp = fopen ("mydir/myfile.php","w");
fclose ($fp);
?>

Expected result:
----------------
a) Directory does not exist
Directory will be created using the UID of the script and afterwards create the file.

b) Directory does exist
A warning (or notice? or whatever it is) will be printed out because the directory already exists and afterwards the file will still be created. Expecting the right UID (same as the script) has created the directory.

I want to request, that files and directories are always have the UID of the script (and the UID of the "uploader") rather than the UID of the server which causes many providers to disturb normal PHP file actions.

Actual result:
--------------
a) Directory does not exist
Directory will be created using the server UID and afterwards there will be an error while creating the file (SAFE MODE ...).

b) Directory does exist
A warning (or notice? or whatever it is) will be printed out because the directory already exists and afterwards the file will not be created because the script is not allowed to write in the directory (SAFE MODE ... UID ...).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-30 15:18 UTC] roman at compic dot ee
it'sno a bug. it's a safe_mode 1
The only chance is:
1) set correct open_base_dir
2) disable system, popen,exec, and so on (exec_functions)
3) turn safe_mode 0

dir can be created, anyway. assume chmod 777 on it top dir.
also chmod _not_ working in SAFE_MODE.

Also, your can run this script as CGI. UID will be same as you, not nobody. so you can make folders and files ;)
 [2005-02-11 08:34 UTC] 4u at direct-netware dot de
Cleaning up really old entries ...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC