July 10, 2005

Windows Search Doesn’t Look Inside PHP Files

Recently I was trying to search through a group of files for a particular word. And in most cases, Windows Search works fine for this. There’s a box to type in the text you’re looking for, and Windows scans the text of each file to find your word. But this time it wasn’t working. And the catch is that I was scanning a bunch of PHP files for a particular piece of code. And even though I knew that code existed in these files, the Search Assistant was saying “There were no results to display”.

So Windows is pissing me off again. What else is new? This time it was refusing to search inside PHP files, even when I told it to. After some searching around, I found the solution. It’s outlined in this Knowledge Base article, under Method 2.

  1. Click Start, and then click Search (or point to Search, and then click For Files or Folders).
  2. Click Change preferences, and then click With Indexing Service (for faster local searches).
  3. Click Change Indexing Service Settings (Advanced). Note that you do not have to turn on the Index service.
  4. On the toolbar, click Show/Hide Console Tree.
  5. In the left pane, right-click Indexing Service on Local Machine, and then click Properties.
  6. On the Generation tab, click to select the Index files with unknown extensions check box, and then click OK.
  7. Close the Indexing Service console.

And it works, and now I can search through PHP files for a particular piece of code. I don’t know why this is turned off in Windows XP…maybe to make searches faster? Personally I’d rather add five seconds to the search time and find the results I’m looking for, but I’m just kooky that way.

Filed under The Computer Vet Weblog

Comments (24)

Comments RSS - Write Comment

  1. Winston says:

    Thank you very much for this tutorial! It helped my locate some bugs that I got after upgrading my e107!

    Posted March 29, 2006 @ 4:07 pm
  2. Hanno says:

    Excellent ! Excellent! Excellent !

    Posted August 4, 2006 @ 5:42 am
  3. Bashar says:

    Gracias 🙂

    Posted March 4, 2007 @ 8:43 am
  4. Warren says:

    I am very glad I found this tutorial. I had a similar situation as you – looking for a string I knew existed in a php file and being told it didn’t exist. HOW FRUSTRATING. You saved me a lot of time and lowered my blood pressure. Thanks.

    Posted March 8, 2007 @ 8:27 am
  5. mohd says:

    perfect, i checked microsoft site but so confusing, this was great, thanks

    Posted May 12, 2007 @ 12:10 am
  6. Ajax says:

    I had this same problem
    Mark Ghosh found this solution

    If you are on a Windows Platform, create an import.reg file with the following in it (where .phps is replaced with the extension of files you would like to search inside, such as .cfm .php or .xml). Multiple ones can be added by making copies of the registry key and replacing the extension.

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\.phps\PersistentHandler]
    @=”{5e941d80-bf96-11cd-b579-08002b30bfeb}”

    Save, double click, say yes, reboot and voila, now it searches inside those files for you.

    http://weblogtoolscollection.com/?p=464

    Posted July 28, 2007 @ 12:10 pm
  7. Elías says:

    Thanks!!! Been looking for this for some time.

    Posted October 26, 2007 @ 8:48 am
  8. JT says:

    I had put a little mail() test in a file and subsequently forgot which one. Going live my inbox was being shot to shits with test mails and I couldn’t find the damn line on Windows (last time I do PHP on Windows) until I found your solution. Thanks!

    Posted October 26, 2007 @ 8:58 am
  9. Barry says:

    In my simplicity I also expected “All Files” to mean just that. But, no, MS knew better, and so a lot of time was wasted trying to find things I new were there, somewhere.
    Thanks so much for the help! Now “Search” actually does what it claimed to offer.

    Posted November 24, 2007 @ 7:18 pm
  10. Craig Roberts says:

    Thanks for sharing, saved me hours of cat and mouse with my php files.

    Posted December 22, 2007 @ 9:35 am
  11. Adam says:

    I used this for .xml files instead of .php files, but it of course still worked. Thanks!

    Posted April 21, 2008 @ 6:12 am
  12. Haiken says:

    I had the same issue and found your solution
    Thanks you so much !

    Posted April 23, 2008 @ 8:27 am
  13. Eric says:

    I really appreciate this tutorial on indexing files for XP, and have used it to great success in the past. HOWEVER, how do you achieve the same result in VISTA? I need to “index files with unknown extensions” in this new much-hated OS. Any help?? Thanks.

    Posted July 17, 2008 @ 6:14 am
  14. Nee says:

    Just popping in with a “Thanks!” as well. I couldn’t figure out why my new laptop wouldn’t search through XML files like my old one did, and this fixed the problem instantly. Thanks again!

    Posted July 26, 2008 @ 9:02 pm
  15. Faizan says:

    Lots of Lots of Lots of Thanks 🙂

    Posted September 11, 2009 @ 6:02 am
  16. Jon says:

    Yeah!!! Works a charm. Great. Fuck you Microsoft!

    Posted September 30, 2009 @ 7:56 pm
  17. wb says:

    Thanks friend!

    Posted October 29, 2009 @ 8:28 am
  18. Cinegirl says:

    Thanks for the info..it helped me a lot.

    Posted November 7, 2009 @ 1:13 am
  19. Jimbo says:

    Here it is 2010 and this article has come in handy for me. Thank you!

    Posted January 6, 2010 @ 1:01 pm
  20. dio says:

    Thank you !!!

    Posted July 8, 2010 @ 3:51 am
  21. Bushy says:

    Thanks! This has been pissing me off too!

    Posted August 26, 2010 @ 6:33 pm
  22. User says:

    Thanks so much!

    Posted October 18, 2010 @ 2:42 pm
  23. Joey says:

    Perfect! Saved me so much debugging time.

    Posted April 26, 2011 @ 7:54 am
  24. Murray Cowell says:

    This is so obscure that I would never have found it without this article. Thanks very much.

    Posted May 7, 2011 @ 4:28 am

Write Comment