How (or can) I change the following php script
so that when it creates a new file, it gives the file r/w
permission?
<?php
if(isset($_GET['data'])) {
$data = $_GET['data'] . "\n";
$ip = $_GET['ip'];
$ret = file_put_contents('/opt/tomcat7/webapps/servlets/WEB-INF/logs/' . $ip, $data, LOCK_EX);
if($ret === false) {
die('There was an error writing the lab data file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no data to process');
}
?>
Try chmod function.
For example chmod("/somedir/somefile", 0755)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.