Adding a local search engine to your website not only serves your visitors: it will provide you with a tremendous amount of precious data. You will learn about what your visitors are looking for, how do they search for it, the most popular searches, etc. You can then put this data to your service by optimizing your pages, writing new content, etc.
I used to use phpDig a lot but since it hasn’t been updated since 2005, so I need to find an alternative. I’ve found out about Sphider, a free PHP crawler, so we’re going to try it out today.
Installing Sphider
This is a quick and dirty guide to installing Sphider.
- Grab yourself a copy of Sphider.
- Extract the content from the archive and upload it to your web server. For my part, I’ve uploaded it into http://www.mydomain.com/search
- Unless you want to use an existing MySQL database, create a new one.
- From your Sphider directory, edit settings/database.php and set the connexion parameters for your database. Save the file and exit the editor. Upload the file to your web server.
- Again from the Sphider directory, edit admin/auth.php and set the username and password you want to access the administration interface. Save the file and exit the file editor.
- Open your browser and point it to http://www.yourdomain/search/admin/install.php (or whatever directory you installed Sphider into).
- The database tables should’ve been created successfully at this point. If not, verify your connexion settings in settings/database.php
- Click on the admin.php link, it will take you to the administration interface.
- Under the Site tab, click on Add Site and enter the information for the web site you wish to index.
- Click on the Reindex All link. This may consume a lot o resource though, make sure you don’t get your hosting account suspended.
- Once the indexing process is completed, open your browser at http://www.yourdomain.com/search/search.php and try searching your website. I was impressed, Sphider seems pretty fast considering I had over 1000 pages to index.
So that’s pretty much it, you now got a local search engine on your website. Here are a few tips to make it better:
Disallow Indexing Of Unwanted Directories
Create a robots.txt file a the root of your website and include the following content to disallow spidering of unecessary folders:
User-agent: *
Disallow: /admin
Disallow: /go
Disallow: /oa
Disallow: /search
Disallow: /visit
Disallow: /feed
Setup A Scheduled Task To Reindex Your Website Automatically
Use CRON (on Linux-based servers) to schedule a reindexing task. If you’re running a dedicated server and that your control panel does not allow you to manage cron tasks, create a file named sphider.sh in /etc/cron.daily and insert the following content:
#!/bin/sh
/path/to/php /path/to/sphider/admin/spider.php -all >> /dev/null
This will reindex all websites everyday. Of course you could set a different indexing cycle and set different spidering options.
If you are using cPanel, here’s how to setup a cron job to execute spider.php once a day at 1am:

Change the default search page
Instead of using http://www.yourdomain.com/search/search.php, you can make the search page the default page. Simply rename /search/search.php to /search/index.php and replace all occurences of search.php by index.php in /search/templates/search_form.php.
Of course if you use another template than the standard one, you’ll have to modify it too.







May 31st, 2008 at 2:08 pm
I found a tutorial to add a Tag cloud to sphider, located here http://www.tring-web-design.co.uk/resources/sphider-tag-cloud.html
June 6th, 2009 at 3:04 pm
Доска объявлений top-searches.ru мега отдача от рекламы и лучший поиск и элитная недвижимость подать объявление top-searches.ru
June 10th, 2009 at 2:39 am
i have found useful seo spider http://www.crawltrack.net/
this is very useful for website developers
September 24th, 2009 at 3:04 pm
I use sphider for several different web sites on three different web servers. I also have a cron set up to automate the indexing process. Works like a charm!!!
November 28th, 2009 at 1:23 am
#!/bin/sh
/path/to/php /path/to/sphider/admin/spider.php -all >> /dev/null
The code above is great but how do you auth a user.
in the code above how do you add a user name and passwrd to log into the admin to begin the crawl?
Thank you in advanced
Mars
December 24th, 2009 at 7:46 am
Обучение вождению.Автомобиль-Hyundai Accent(МКПП) Уроки вождения в Юго-Западном округе Москвы. Лицензия на обучение. Стаж-33 года. Цена 1000р-90 мин. Анатолий 8-916-832-33-48 с 7.00-22.00
December 25th, 2009 at 6:41 am
Продам/Купить кельтскую Арфу, новая доставка по всей России и СНГ. Есть разные модели подберем любую звоните 8-905-703-56-21 Максим, garant1979@yandex.ru
January 20th, 2010 at 9:18 am
Продаю Мак 2009г Испания Самовывоз 12 км МКАД 25/50кг Цена до 1т-300р; 1-2т 290р; 2-3т 280р; 3-5т 250р; 5-10т 240р; 10-20т 230р; от 20т 220р. 100% предоплата безнал makroman@list.ru 89267190344 Роман
January 25th, 2010 at 11:29 pm
Mars, the user “Wardrop” at Sitepoint.com answered your question at http://www.sitepoint.com/forums/showthread.php?t=558432. “A username and password would have only been required if accessing the file via http, which in this case you’re not.”
January 29th, 2010 at 8:32 am
Thanks!
I happened upon Sphider via you site about two months ago.
I had it up and running in minutes just like you said.
Since the I’ve tried everything known to a newbie novice under the sun to get Cron to automatically index the site but nothing so far.
I know that you know a great deal so “Help!” I’m using /usr/bin/php -f/ home/myusrname/public_html/sphider/admin/spider.php -all >> /dev/null
but it just won’t go.
What are your best clues?
Please!
February 4th, 2010 at 8:05 pm
Торшеры зеркала Luminex доставка. Торшеры Польша. Магазин светотехники. Люстры и светильники производство Польши.
February 5th, 2010 at 7:10 am
Люстры торшеры бра зеркала Luminex заказ, наличие. Светильники потолочные Польша. Магазин люстры больших размеров в Москве. Люстры производство Испании.
February 8th, 2010 at 8:11 am
Мастерская изготавливает на заказ: шкафы-купе, стенки, библиотеки, книжные шкафы, комоды, офисную мебель, столы для президиума, трибуны, шкафы-картотеки, и т.д. (8 495)968 55 09 сайт:zmb2000.ru
February 9th, 2010 at 12:28 pm
Люстры торшеры бра зеркала Luminex заказ. Торшеры Alfa. Магазин люстры хрустальные. Люстры и светильники производство Испании.
February 9th, 2010 at 1:32 pm
Стиль классика светильники бра Италия Reccagni Angelo: интернет-магазин осветительные лампы Москва. Красивые лампы производство Италия.
February 10th, 2010 at 12:07 pm
Торшеры зеркала бра Luminex заказ, доставка, наличие. Люстры светильники испанские. Магазин большие хрустальные люстры в Москве. Люстры производство Испания.
February 10th, 2010 at 12:30 pm
Люстры бра зеркала Luminex доставка, наличие. Бра Испании. Магазин светильников в Москве. Светильники и люстры производства Польши.
February 10th, 2010 at 1:25 pm
Стиль модерн в интерьере светильники бра Lussole: интернет магазин люстр в Москве. Красивые лампы производство Италия.