stevebeans2 Posted August 4, 2011 Share Posted August 4, 2011 I have a small network of sites currently on a VPS server, and I use file_get_contents in the wordpress theme to call a few things, like sidebar links, etc. Anyway, it currently works on the VPS, but I purchased a dedicated server, and that appears to be causing a freeze when the pages load. (allow_url_fopen is set to on btw) I found out because wp-admin loads fine, stand alone pages are also ok, so I started stripping file_get_contents from my theme, and sure enough the blog loaded fine. So my questions are, 1) Is there a setting on the server I'm missing to allow remote calls? A port that needs opening, etc? 2) Is file_get_contents really the best way to call remote .txt files? I'd like to figure out the answer to (1) because I don't have the time to go through 50+ blogs and convert file_get_contents to the new format before my VPS plan expires, but when the sites are migrated and I have time, I'd certainly like to convert the includes to a better format. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/243816-file_get_contents-freezing-new-server/ Share on other sites More sharing options...
stevebeans2 Posted August 4, 2011 Author Share Posted August 4, 2011 An update.... I was able to find that the file_get_contents command works as long as I'm not calling files from my own server. If I call from my old server, it appears to still be working. Perhaps it's a DNS issue, or a setting on my server Quote Link to comment https://forums.phpfreaks.com/topic/243816-file_get_contents-freezing-new-server/#findComment-1251909 Share on other sites More sharing options...
trq Posted August 4, 2011 Share Posted August 4, 2011 Why are you using http to call files on your own server? Quote Link to comment https://forums.phpfreaks.com/topic/243816-file_get_contents-freezing-new-server/#findComment-1252222 Share on other sites More sharing options...
stevebeans2 Posted August 4, 2011 Author Share Posted August 4, 2011 They are between accounts, but I'd certainly use a different, more efficient way, I just don't know it I am quite a php noob Quote Link to comment https://forums.phpfreaks.com/topic/243816-file_get_contents-freezing-new-server/#findComment-1252225 Share on other sites More sharing options...
phpSensei Posted August 5, 2011 Share Posted August 5, 2011 PHP function include ? Quote Link to comment https://forums.phpfreaks.com/topic/243816-file_get_contents-freezing-new-server/#findComment-1252248 Share on other sites More sharing options...
stevebeans2 Posted August 5, 2011 Author Share Posted August 5, 2011 Wow... I really am a noob. I think I tried that when I first started blogging and doing my own themes, probably messed up a piece of the code or the server was whacked so I went to file_get_contents. Oh well, learn something new. This should lower some server load, that's for sure. Thanks (btw, as per my problem, it was fixed before this post. I honestly don't know what fixed it, but I did a reboot of my DNS server and all is working now... crossing fingers) Quote Link to comment https://forums.phpfreaks.com/topic/243816-file_get_contents-freezing-new-server/#findComment-1252253 Share on other sites More sharing options...
phpSensei Posted August 5, 2011 Share Posted August 5, 2011 Ah, I see. file_get_contents won't intervene with server speed unless your writing a monster load script in my opinion, or the http call, but the method you were using is not required since the file is already on the server. Quote Link to comment https://forums.phpfreaks.com/topic/243816-file_get_contents-freezing-new-server/#findComment-1252265 Share on other sites More sharing options...
trq Posted August 5, 2011 Share Posted August 5, 2011 They are between accounts, but I'd certainly use a different, more efficient way, I just don't know it I am quite a php noob Still, there on the same filesystem. Quote Link to comment https://forums.phpfreaks.com/topic/243816-file_get_contents-freezing-new-server/#findComment-1252277 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.