I am trying to create a file in the /tmp directory and unable to. It won't even let me create a file in the same dir I am in (/var/www/html). I believe I dont have the correct setting on my php.ini, but I dont know what I need to change to make this work.
My OS is CentOS7 and I am running Apache with php 5.4.16. I do have read/write on /var/www/html and the user/group is set to apache. Below is just a generic code to write a file which is not working, I keep getting "Unable to open file"
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
Asked by user2236794
(221 rep)
Jan 8, 2020, 08:44 PM
Last activity: Jan 10, 2020, 10:40 AM
Last activity: Jan 10, 2020, 10:40 AM