First, let's take a look at the file_get_contents () function. The official introduction says it reads the entire file into a string.
Example
<? Php
Echo file_get_contents ("test.txt ");
?>
Output:
This is a test file with test text.
This function can also be used to obtain the content on the remote server.
File_get_contents ('http: // www.111cn.net ');
This is no problem, but if I bring the port, it will be a problem.
For example:
File_get_contents ('http: // localhost: 100 ');
There is no get.
Solution: disable selinux.
1 Permanent method-server restart required
Modify selinux = disabled in the/etc/SELINUX/config file, and then restart the server.
2. Temporary method-set system parameters
Run the setenforce 0 command.
Appendix:
Setenforce 1 sets SELinux to enforcing mode
Setenforce 0 sets SELinux to permissive mode
Php's allow_url_fopen option is disabled.
The reason is that the allow_url_fopen option of php is disabled in php. ini. We just need to open it.
If you do not have the permission to open allow_url_fopen, we can use the curl function to replace it.