May 18, 2012

Searching Within PHP/Text Files

Have you had to search for a line of PHP code withing a group of PHP files?  We have, and often.  The Windows search function lacks the ability to search within PHP and other file types.  Here’s a great little tweak that will change that.

ALWAYS REMEMBER TO BACKUP YOUR REGISTRY

You will need to create a .reg file and it has to be in a binary format.  So lets create a copy of an already Windows Searching capable .reg file.

  • Go to Start > Run and enter Regedit.
  • Click OK.Browse to HKEY_CLASSES_ROOT > .xml.
  • Right click on it and select Export.
  • Save it to your desktop and name it php.reg.
  • Use an editor, like NotePad, to edit the program to show.

[HKEY_CLASSES_ROOT\.php]
“PerceivedType”=”text”
@=”phpfile”

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

  • Save the file.
  • Double click pnp.reg.
  • It’ll will prompt you want to add it to the registry, say yes.
  • Restart the computer.
  • Try searching with a directory for a line of code in a php file and be amazed.

You can change @=”phpfile” to @=”" so that it search all files.  Not sure why you wouldn’t do that..