note 130116 added to function.fopen
| From: | turabgarip@gmail.com | Date: | Tue, 04 Mar 2025 12:10:25 +0000 |
| Subject: | note 130116 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221944@lists.php.net to get a copy of this message | ||
Note that for fopen() to create files when called with such mode, the path you have given needs to
exist as fopen() cannot create directories; but only files it can create. This is normal behavior.
<?php
// Write log file, create if not exists
$log = fopen('/var/logs/someapp/error.log', 'wb');
// This will silently fail if /var/logs/someapp directory doesn't exist
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 46.1.2.249)
----
Manual Page -- https://php.net/manual/en/function.fopen.php
Edit -- https://main.php.net/note/edit/130116
Del: integrated -- https://main.php.net/note/delete/130116/integrated
Del: useless -- https://main.php.net/note/delete/130116/useless
Del: bad code -- https://main.php.net/note/delete/130116/bad+code
Del: spam -- https://main.php.net/note/delete/130116/spam
Del: non-english -- https://main.php.net/note/delete/130116/non-english
Del: in docs -- https://main.php.net/note/delete/130116/in+docs
Del: other reasons-- https://main.php.net/note/delete/130116
Reject -- https://main.php.net/note/reject/130116
Search -- https://main.php.net/manage/user-notes.php