fopen() and file_get_contents() Do not work on PHP Advanced

Status
Not open for further replies.

GG-Xtreme

New Member
Messages
430
Reaction score
0
Points
0
I recently upgraded to PHP advanced to fix a sitemap script. Well, now it actually starts, but halfway through, I get:
Code:
[B]Warning[/B]:  fopen(http://www.google.com/webmasters/sitemaps/ping?sitemap=http%3A%2F%2Fmercx.exofire.net%2F%2Fsitemap.xml) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found  in [B]/home/*****/public_html/*****/inc/functions/parsing.inc.php[/B] on line [B]545[/B]
(I have added the asterisks myself to obfuscate the URL)
followed by:
Code:
[B]Warning[/B]:  feof(): supplied argument is not a valid stream resource in [B]/home/*****/public_html/*****/inc/functions/parsing.inc.php[/B] on line [B]551[/B]

[B]Warning[/B]:  fread(): supplied argument is not a valid stream resource in [B]/home/*****/public_html/*****/inc/functions/parsing.inc.php[/B] on line [B]552[/B]
Those 2 errors keep repeating thousands of times until I close the page. I tried replacing fopen with file_get_contents, but the same thing happens (except that the function says 'file_get_contents' in the error). The script worked just fine before the 'upgrades' that x10 underwent, but it is the only thing that remains broken.
Edit:
*bump* Why are the fopen and file_get_contents functions getting a 404 when I can visit the page in my browser just fine? I don't want to be suspended for high resource usage, because since the script won't connect, my cron job is stuck in an infinite loop.
 
Last edited:

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
Is it still doing it now?

-Corey
 

GG-Xtreme

New Member
Messages
430
Reaction score
0
Points
0
The file_get_contents() is now working, but I still keep getting those other 2 repeating errors. I think this may have crashed my cron manager, because I am no longer receiving emails and it is no longer being triggered automatically, even though it is set to run on an hourly basis.
 

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
The 2 errors posted above are errors with the code and not with the PHP version.

Cron is up and working on your server.

-Corey
 

GG-Xtreme

New Member
Messages
430
Reaction score
0
Points
0
Do you have any idea why I didn't get any errors before the upgrade then? Also, I am getting a new error:
Code:
Warning:  ini_get() has been disabled for security reasons
I need that function for the same reason I needed set_time_limit(): to prevent the script from timing out before saving its state so it can restart.
And according to Google Webmaster Tools, the script hasn't had a successful run in over 24 hours.
 
Last edited:

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
ini_get is enabled, the other errors I am not sure. They are not function disabled errors.


-Corey
 

GG-Xtreme

New Member
Messages
430
Reaction score
0
Points
0
Ok, I fixed it. Apparently, one of the arrays couldn't get data from file_get_contents(), so I reverted to fopen() and now it works.
Edit:
Great, one run of my script instantly got me suspended for high resource usage. Did the limit get a lot lower or something? This used to run hourly just fine, that's why it uses set_time_limit() and such. Does that mean that if my script is in cron jobs, I will get suspended every hour?
Edit:
Now this is going nowhere, I'm getting
Code:
function within blacklist called: set_time_limit()
again on PHP Advanced? How come it's disabled again, I just got it working a couple of hours ago.
 
Last edited:

GG-Xtreme

New Member
Messages
430
Reaction score
0
Points
0
Remove the set_time_limit line. That shouldn't make a difference.
I will give that a try, but the weird thing is if I run the script from my browser, it runs just fine and Google Webmaster Central says that it received the sitemap successfully within minutes, but if I run it via cron jobs, I get the set_time_limit error and Google Webmaster Central doesn't get the updated sitemap.
Edit:
Ok, I removed the line and it seems to be working now. I will post back if I have more problems.
Edit:
Update: Apparently the set_time_limit line was necessary--now my script, after running for approximately 47 seconds (it is a sitemap generator) times out and manually asks me to click a button in order to continue from where it left off. Of course, this defeats the purpose, because I have this script running via cron jobs, which can't click anything and just emails me the unfinished result while not updating my sitemap and not sending it to Google. Is there a specific reason I cannot use set_time_limit even with PHP Advanced? I though a simple sitemap script would be something allowable even on a free hosting plan. I can also run the script using my MyBB task manager, but it will still time out and fail to complete.

Edit: I created a new thread, since the topic has changed.
 
Last edited:
Status
Not open for further replies.
Top