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

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -