PHP creates file permissions on the server
PHP Code
$res = fopen ('/usr/local/asg/configs/meet.conf ', ' A + '); fclose ($res);
On the local machine if the meet.conf file does not exist, it can be created, but not on the server, with the LS command to see, there is no writable permission, so, in the code to add a judgment
PHP Code
if (!is_writable ('/usr/local/asg/configs ')) { system (' chmod 777/usr/local/asg/configs ');} $res = fopen ('/usr/local/asg/configs/meet.conf ', ' A + '); fclose ($res);
After the operation, still cannot create, again improved the next
PHP Code
if (!is_writable ('/usr/local/asg/configs ')) { system (' chmod 777/usr/local/asg/configs ');} System (' touch/usr/local/asg/configs/meet.conf ');
Run down, still not, again flexible, with putty Landing to the server, with the command line into the directory, directly with touch to create, I fork, useful, why the PHP file run will not be successful???
------Solution--------------------
I think you can use PHP function chmod to do this operation
Also, to give PHP a running account with this directory permission
------Solution--------------------
if (!is_dir ('/usr/local/asg/configs ')) {
mkdir ('/usr/local/asg/configs ');
chmod ('/usr/local/asg/configs ', 0777);
}
------Solution--------------------
For PHP does not have permissions to the directory, how can be given by PHP?
It's like you don't have the authority to go into the State Department, so you can't get into it unless you're looking for a relationship.