简体   繁体   中英

PHP file_get_contents() is not working on PLESK / CENTOS7 Server

I was using cpanel before, but I'm using Plesk Panel / Centos7 now. I moved my sites to Plesk Panel from CPanel. I'm runing file_get_contents() function, but it's not working on Plesk Panel.

Why? I dont know why. What should i do?

my code;

$data = file_get_contents('http://example.com');

this code is not working on Plesk Panel.

Thanks, best regards.

What is error message says? if error message says, the stream (URL) requested cannot be opened. There are many possible reasons for this: 1. base URL is bad. $pc['pcname'] 2. username and/or password are bad 3. username/password do not have permission on the server 4. Your system cannot reach the server (firewall, PHP permissions, ...)

I would use the following strategy to debug: 1. Dump $url and write it down. 2. Use a browser with debug tools (eg Firefox/Firebug) and try to access that URL. 3. Look at the headers returned to see what error the server reports (if any). 4. Think about why that error is returned

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM