php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50865 I'm Not able to create a file using fopen
Submitted: 2010-01-27 20:18 UTC Modified: 2010-01-28 08:26 UTC
From: kv_abhiram at yahoo dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.2.12 OS: Leopard 10.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kv_abhiram at yahoo dot com
New email:
PHP Version: OS:

 

 [2010-01-27 20:18 UTC] kv_abhiram at yahoo dot com
Description:
------------
This is my code where i create a new php file using php.
I'm not able to use fopen to create the file. If i use chmod to change 
the permissions. It is not allowing me to do that.

Warning: chmod() [function.chmod]: Operation not permitted

This is the error i get if i use chmod

Reproduce code:
---------------
//chmod("/Library/WebServer/.../", 777);

$create_file = fopen($file, "w");
$content = "1";

$fname = "/Library/WebServer/.../".$seasonx;

if (is_writable($fname)) {
if (!$hand = fopen($name, 'w+')) {
echo "Cannot open ($fname)";
exit;
}
if (fwrite($hand, $content) === FALSE) {
echo "Cannot write to ($fname)";
exit;
}
echo " success";
fclose($hand);
} else {
echo "The file $fname is not writable";
}



Expected result:
----------------
success.


[It should also create a file called 5.php where 5 is the value of the 
variable $seasonx at that instance

Actual result:
--------------
The file /Library/WebServer/...5 is not writable

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-28 08:26 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 01:01:28 2024 UTC