apache2.4.6 php 7.2.2 installed with Yum returns False when opening a file using the fopen () function after proper installation
Baidu for three different reasons
1, directory or folder permissions reasons
(You can set the highest permissions with the Chmod-r 777 root folder)
2. Open File path error
3, open mode error (W,R,A), etc.
Determined not to have the above error
Add a PHP error report manually
// Error handler function function customerror ($errno$errstr) { echo ' <b>error:</ b> [$errno$errstr";} // Set Error Handler Set_error_handler ("Customerror");
The error message returned is
Failed to open Stream:permission denied
Prove no permissions
Switch to read-only mode to open normally
Guess it's php that restricts permissions.
Search Open_basedir in php.ini view configuration, default is commented out, that is, there is no Limit permissions
Finally on the internet all kinds of Baidu
found that the default installation of the CentOS system has selinux rights management, and is enabled by default
Baidu has a bit of selinux, the introduction of most of them are directly closed, configuration seems to be very troublesome
Then it's still closed.
Vim/etc/selinux/conf
Can see
selinux= Enforcing
Revision changed to
Selinux=disabled
Can
Restarting the server
Write file again normal
The PHP fopen function returns false