#50865 [NEW]: I'm Not able to create a file using fopen
| From: | kv_abhiram at yahoo dot com | Date: | Wed, 27 Jan 2010 20:18:32 +0000 |
| Subject: | #50865 [NEW]: I'm Not able to create a file using fopen | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-147006@lists.php.net to get a copy of this message | ||
From: kv_abhiram at yahoo dot com
Operating system: Leopard 10.6
PHP version: 5.2.12
PHP Bug Type: Apache2 related
Bug description: I'm Not able to create a file using fopen
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
--
Edit bug report at http://bugs.php.net/?id=50865&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50865&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50865&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50865&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50865&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50865&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50865&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50865&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50865&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50865&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50865&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50865&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50865&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50865&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50865&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50865&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50865&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50865&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50865&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50865&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50865&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50865&r=mysqlcfg