I have a php that creates a file that needs to be executable (it's a batch file that needs to be run by the system). For some reason, even though the file is owned by apache and php is running as apache, and the file IS created, the script dies at the chmod line. What do I need to configure differently to allow the php to chmod the file it creates? Two lines above it happily creates a directory FOR this file which it chmods to 755 right as it creates it. Am I missing something obvious?
my chmod line looks like this:
$uploadFilePath = "./path/to/file/";
if(!is_dir($uploadFilePath)){
mkdir($uploadFilePath, 0777 , true) or die("ERROR:can't create directory '$uploadFilePath'");
}
...
//write batch file
...
chmod ($uploadFilePath . 'sftp.batch' ,0777 ) or die ("\ncan't chmod " . $uploadFilePath . 'sftp.batch');
Most probably due to umask. Try setting it to 0
prior to the chmod
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With