From: xmeltrut at gmail dot com Operating system: All PHP version: 5.4.8 Package: Filesystem function related Bug Type: Feature/Change Request Bug description:Option for fopen to create directories
Description: ------------ Currently, fopen allows you to create new files, but not in directories that don't exist - for example, if you want to write to /tmp/logs/something.log, you have to check that /tmp/logs exists every time, before running your fopen. It would be convenient if you could pass a flag to fopen to tell it to recursively create any missing directories in the path, in order to open the file. Test script: --------------- fopen('/tmp/logs/test.log', 'w'); // fails if logs doesn't exist mkdir('/tmp/logs'); fopen('/tmp/logs/test.log', 'w'); // fails if logs does exist -- Edit bug report at https://bugs.php.net/bug.php?id=63456&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63456&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63456&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63456&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63456&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63456&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63456&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63456&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63456&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63456&r=support Expected behavior: https://bugs.php.net/fix.php?id=63456&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63456&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63456&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63456&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63456&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63456&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63456&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63456&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63456&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63456&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63456&r=mysqlcfg