I got an issue with my centos server, It, from 3 days ago won't allow me to edit files (write into .txt) create files or create directories with mkdir.. I checked the file ownage, runned whoami and checked the php file had the right permissions but it doesn't want to work. Might someone suggest me troubleshootings? Also I tried switching from nginx to httpd and repeat the permission checks but still nothing.
running ls -l on the php script it outputs the following:
-rwxrwxr--. 1 nginx nginx 63 Dec 21 14:31 cartella.php
and after : chown apache:apache -R /usr/share/nginx/html/cartella.php
-rwxrwxr--. 1 apache apache 63 Dec 21 14:31 cartella.php
also permissions I tried setting them to 644/755/777 but neither one worked.
Php code that worked till a few days ago:
exec(" > test.txt"); //to empty the file and set the right permissions
$myfile = fopen("test.txt", "a") or die("Unable to open file!");
fwrite($myfile, $text);
fclose($myfile);