Creating text files through php in linux -
i trying create new text file through php following command:-
<?php $new = fopen('newfile.txt', 'w'); ?>
somehow unable create because of permissions issues of linux. can create text file first set it's permissions. or there way in code itself? either way need job done.
you can create directory , give 744 permissions
$dir = 'output'; if ( !file_exists($dir) ) { $mask = umask(0); // helpful when used in linux server mkdir ($dir, 0744); } file_put_contents ($dir.'/test.txt', 'hello file');
Comments
Post a Comment