PHP Debugging Tip

Page not loading right? Try putting this at the top inside a <?php block…

print_r( $_REQUEST);

I was having a problem where http://meat.net/2005/11/xml-js-freeze/ was coming up blank. Turns out the following regexp is at fault:

RewriteRule ^(.+).xml /index.php?feed=$1 [QSA,L]

I’ve fixed the feed director plugin, you can see my patched version at here.

Troubleshooting tip comes courtesy of Dr. Dave, also known as the evil genius behind Spam Karma. All hail IRC. :)

Update: I forgot to restore the symlink when I upgraded wordpress to 2.0 and redid my plugins dir from scratch. Fixed now.

This entry was posted in tech. Bookmark the permalink.

10 Responses to PHP Debugging Tip

  1. Andrew Milo says:

    Hmm.. Thanks for this tip… The link

    http://meat.net/wp-content/plugins/feed_director.phps

    is a 404. Is is possible for you to put it there? I want to make sure that I do this right. :)

    I take it that the .phps on the end of these types of files is just so that it doesn’t execute and that it should be changed to .php, right?

    Thanks again.

  2. Andrew Milo says:

    Hi thanks for the tip…

    Unfortunately, the link

    http://meat.net/wp-content/plugins/feed_director.phps

    is a 404. I was hoping you might rectify that. :) I want to make sure that I’m doing this right. I’ve tried to edit my .htaccess myself, but I can’t seem to get a number of them to work properly.

    Also, I assume that these files are .phps to keep them from executing on your site and need to be changed to .php?

    Thanks again.

  3. dbt says:

    Whoops. Didn’t restore the symlink when I redid all my plugins when I upgraded to wordpress2. Fixed.

  4. Andrew Milo says:

    Hey, thanks very much for the update! :)

    Am I right about the .phps to .php change?

    For some reason the plugin seems to act strange. I’m using WP 2.0.1 and all of my feeds work in the general ways – index.php?feed=rss2 works just fine, but the plugin doesn’t seem to do the redirect. I still get a 404 error with it. :(

    Any words of wisdom? Thanks very much,
    Andy

  5. dbt says:

    You have to get the text of the .phps file, it’s pretty-formatted by the PHP engine. lynx -dump $url > file is good for this.

    Save it into plugins directory, enable the plugin in the plugin menu.

    Then try http://foo/atom.xml it should work.

  6. James Farmer says:

    Hiya, Really appreciate you putting this up here (as am a bit stuck: http://wordpress.org/support/topic/65998?replies=1#post-349736 )

    Have tried the above on my test site 2.0.2 WP site but am still having no luck… I iknow this is a huge imposition but is there any way you could tell me if I’m barking up teh wrong tree trying to get this to manipulate the RSS feed address to come out at http://site.com/xml/rss.xml

    Thanks again, James

  7. dbt says:

    James — try adding below the line:
    ‘index.xml’ => ‘index.php?feed=rss2′,
    a line that says:
    ‘xml/rss.xml’ => ‘index.php?feed=rss2′,

  8. James Farmer says:

    Wow! Thanks for the quick response :)

    I think you’ve solved a 2 day problem for me too, so double thanks!

    I made the change you suggested and activated the plugin, but first up no joy.

    So… in order to get it to work, I had to delete my existing.htaccess, reinstate a new blank one and 777 it, then switch the permalinks (date & name) on from the options menu… and hey presto, a workaround for the apache-idiot :D

    Thanks again!

  9. Jamie says:

    Hello, yet another pest here… I too have recently moved to wordpress and I am trying to figure out how to get my old feed ( http://www.james-baker.com/news/atom.xml ) to work without changing the address. I have tried to follow the directions but perhaps I am too green to even get the basics? Here’s what i did:

    I copied the text from
    http://meat.net/wp-content/plugins/feed_director.phps

    and created a file in my plug ins directory called

    feed_director.php

    However , it doesnt display in the plugin manager properly. is it because I am using version WP 2.0.2? or am I just being dense?

    I also trie dto use a PLUGIN called FEED LOCATIONS with no joy…

  10. _ck_ says:

    I think part of the problem is after you activate the plugin, it probably helps (maybe actually required!?) to go into options -> permalinks and click the “update permalinks” button.

    Then when I use the “view internal rewrites” plugin I can see the rules added:
    http://www.dagondesign.com/articles/wordpress-internal-rewrite-viewer-plugin/