0

Here is what I'm having trouble with: I've had the below script running for years and it's been fine. But my web host moved / upgraded servers a couple of weeks ago and ever since the script has failed to work.

<?
rename ("/home/website/public_html/feed", "/home/website/public_html/feedx");
file_put_contents('/home/website/public_html/feedx/rss.xml', file_get_contents('http://www.mywebsite.co.uk/feed/'));
file_put_contents('/home/website/public_html/feedx/podcast/rss.xml', file_get_contents('http://www.mywebsite.co.uk/feed/podcast/'));
rename ("/home/website/public_html/feedx", "/home/website/public_html/feed");
?>

Why it is needed and what it does:

  • I run the Blubrry Powerpress podcast plug in for Wordpress. It works great but dynamically generates two RSS feed files every time its called. So for 10,000 subscribers polling the website every hours for new episodes it was spiking CPU usage like crazy.
  • I then created the script which renames the feed directory, calls the URL location (which in turn causes the plugin to fire and generate the RSS files as it must use htaccess to have a virtual path) and saves them as static files on the server. It then renames the directory back and whenever a listener's app polls the server it returns the static file quickly.

Current situation:

If I manually do the steps as in rename the directory in my FTP client, load the URL in Chrome and then Save As the resultant website and upload it to the two locations and rename the folder back - it works fine.

If I run the script on the server it just generates a 0 byte file for each RSS.

Can anyone give me any thoughts and advice on why its not working now and what I can try to fix it?

9
  • 3
    "It fails": well, in what way? Is there logs, error messages? Commented Aug 7, 2023 at 11:37
  • 1
    Read your logs (and check that logging is working). Check the permissions on the paths. Speak to the people you are paying for support who caused the problem. Commented Aug 7, 2023 at 12:00
  • Hey Marcus - "If I run the script on the server it just generates a 0 byte file for each RSS." nothing appears in the logs I can see, no errors. Symcbean - There are none to see, permissions looks same as before rwxrwxrwx on each. Support have not come back with anything for the past week hence posting on here :( Commented Aug 7, 2023 at 12:41
  • The permissions might be the same, but is the owner/group? Often in changing environments the webserver user may have changed. Commented Aug 7, 2023 at 13:32
  • @Csnap - The script is managing to overwrite the original file down to 0 bytes so I think the owner / group would be fine or it wouldnt be able to do this? Commented Aug 7, 2023 at 23:59

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.