physaux Posted November 9, 2009 Share Posted November 9, 2009 Hey guys, I want to create a PHP file, and then chance its permissions. I am doing this because I want to "update" a file that will be included in other pages. I want to set a cronjob to do this once a day or such, so I need to be sure that the permissions will be set properly so that nobody else can activate/ see that file. Here is what I have so far: <?php $myFile = TEMPVARIABLESNAME; // is something like "temp.php" $filepermissions = TEMPFILEPERMISSIONS; // is a int value, such as 700 $fh = fopen($myFile, 'w'); $tempstring = '<?php'; //... $tempstring.= '?>'; fwrite($fh, $tempstring); fclose($fh); chmod($myFile, $filepermissions); ?> Which permissions level should I set for a file that I only want to be accessible from other files "include()"ing it? Any suggestions? thanks! Link to comment https://forums.phpfreaks.com/topic/180861-writing-a-php-file-with-php-then-changing-permissionsam-i-doing-this-right/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.