In that case, you still probably don't need to do all the work yourself ... in MySQL, for example, you can make the column in question a FULLTEXT column, index it, and you now have a column that is fully searchable for any word. Doing this on a table with a million records will take some time, but that's a given, I think. The search will also take a bit of time, too ... but if the column is indexed, it will help.
If you want to search through the table and build up an an index manually, then Perl is probably a much better choice than PHP, as it was pretty much invented just for quickly manipulating large amounts of text.