A problem that has wasted hours of my time is simple.
A simple code
$dir = "temp";
mkdir ($dir, 0755);
Prompted me to permission denied.
I tried to change the parent folder permissions, recreate the folder, change the permissions, move the file, and replace the owner of the folder. Not at all. This mistake is always lingering. The underlying weaknesses of the Linux system are reflected.
Finally, in a friend's reminder, shut down the SELinux. The mistake was gone.
My God, my precious time.
Warning
Don't know how to close SELinux?
Under/etc/sysconf There is a selinux file, use VI to open, change the value of the SELinux item in it.
selinux=disable Disable SELINUX
Selinux=enforcing Use SELINUX
Selinux=permissive uses SELINUX to log errors only.
Remember to reboot.
If you do not reboot, with # Setenforce 0, you can temporarily set the SELinux to permissive mode. Remember to use the root user.
Then use # setenforce 1 This command will set SELinux to enforcing mode.