How to make Spotlight index PHP files

15/05/2005 06:20 | Categories: Apple | 0 Comments 

I was pretty surprised to see that Spotlight does not support PHP files out of the box, even though they're plain text files. I was reading this hint: Spotlight's rules for indexing plain text files when I noticed a very useful comment about how to make Spotlight index PHP files. This is not my stuff, I am just putting it here in case somebody finds it interesting :)

Edit the file /System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist, find the section MDImporter and add public.php-script to the list of files that should be indexed as follows:

<dict>
<key>CFBundleTypeRole</key>
<string>MDImporter</string>
<key>LSItemContentTypes</key>
<array>
<string>public.rtf</string>
<string>public.html</string>
<string>public.xml</string>
<string>public.plain-text</string>
<string>com.apple.traditional-mac-plain-text</string>
<string>com.apple.rtfd</string>
<string>com.apple.webarchive</string>
<string>public.php-script</string>
</array>
</dict>

Save the file and then run the mdimport -d1 file.php command to force Spotlight to reindex the file, or mdimport -d1 -f folder/ to reindex a folder.†



Add comment
 authimage