Installation - compuphase/sphider-pdo GitHub Wiki

A brief summary how to install Sphider-PDO.

Acknowledgement

This page is adapted from the instructions on the original Sphider site.

Most of the original Sphider documentation still applies to this variant, so you may want to look through it for customization options.

Installation

  1. Unpack the files somewhere on your drive. On Microsoft Windows, you can create a folder "sphider" in your "My Documents" folder. On Linux, make a subdirectory in your home directory.Alternatively, you can unpack the files directly on the server, if that is convenient to you.
  2. In the server, create a database to hold Sphider data (in MySQL, SQLite or another supported format).If you have direct access to the server (e.g. with a secure shell login), the steps are:
  • At command prompt type (to log into MySQL): mysql -u <your username> -p(enter your password when prompted)
  • At the mysql prompt, type: CREATE DATABASE sphider_db;(of course you can use some other name for database instead of sphider_db).
  • Leave the mysql client with exitFor more information on how to create a MySQL database and give it the necessary permissions, check http://www.MySQL.com

When you use DirectAdmin:

  • Log-on to your DirectAdmin account
  • Click on "MySQL Management"
  • In the next page, click on "Create new Database"
  • Fill in the database name (e.g. "sphider_db"), the user name and the password. Note that DirectAdmin may prefix the account name to the database name (and/or the user name).

When using SQLite, make sure that the folder in which the database is stored, as well as the file itself, have read/write permissions for the web server pseudo-user. 3. In the "settings" directory, edit the "database.php" file and change the definition of the database (in variable $db); See the page Database configuration for examples and notes, and see the PDO documentation technical details.For MySQL, constant DATABASE_NAME also needs to be set, and possibly TABLE_PREFIX as well.For SQLite, constant AUTOINCREMENT has to be defined as an empty string, for example:define("AUTOINCREMENT", "");The full text of each page is stored in the database. By default, the field for the full text has the type TEXT. The maximum text size that a field with this type can hold is database-dependend: for SQLite it is 1G by default, but for MySQL it is 64k. If you have pages larger than that (in raw text, after removing all HTML tags), you should change this to MEDIUMTEXT for example. 4. In the "admin" directory, edit "auth.php" to change the administrator user name and password (default values are "admin" and "admin"). In this file, you can also disable the web interface for changing the configuration. 5. Upload everything to your web server (not needed if you had unpacked all files on the server directly). 6. Open "install.php" script ("admin" directory) in your browser, which will create the tables necessary for Sphider to operate.So, when your web server is at "www.mydomain.com" and you uploaded Sphider in directory "search" at that domain, you need to type the following address in your browser:http://www.mydomain.com/search/admin/install.phpThe install page just lists a number of names for tables (25 in total) and it should end with a line that all is fine. If there is an error message, or if the table names do not appear, the installation failed. 7. Still in the web browser, open admin/admin.php in browser. Again, the full address would be:http://www.mydomain.com/search/admin/admin.phpYou need to fill in your name and password (the ones in "auth.php"). Note that these are both case-sensitive. 8. Now you can add your site to the search engine. A "site" refers to the first page where the spidering starts. For technical reasons, this must be a true file; it may be a PHP file, but not a redirect. So, continuing the example that your site is at "www.mydomain.com", you could add:http://www.mydomain.com/index.html(This assumes that there is a file "index.html" on the site.) 9. After adding the site, click on the button "options" next to the site and then click on "index". The default spidering depth is 2, which is fine for a test, but see the page Indexing options. 10. "search.php" is the default search page. You can how test the search engine. Assuming that you uploaded Sphider in the directory "search" at the root of the domain, the full address would be:http://www.mydomain.com/search/search.php 11. If the test succeeds, it is recommended to delete the file install.php from the "admin" directory. This is because this script is not password-protected.

Configuration

The Sphider search engine can be customized either through the administrator interface or by editing the configuration file directly.

  • To use the administrator interface, open admin/admin.php in your browser.
  • To change the configuration directly, edit the file settings/conf.php.

Note that the administrator interface can be disabled, for changing the configuration. in the file admin/auth.php, you can set the definition of CONFIGSET to 1 to disable the administrator interface. This increases the security of the search engine (but reduces the convenience).

To change the look of the search page to fit your site, modify or add a template in the templates directory. It is often enough to modify the search.css file and header and footer templates (header.html and footer.html). Heavier modifications can be made through editing the rest of template files.

Excluding files or words.

The list of common words that are not indexed are given in include/common.txt.

The list of file types (or more accurately: file extensions) that are not checked for indexing are given in admin/ext.txt. Note that if you do not enable support for PDF scanning, you may as well add "pdf" as an extension to skip. Otherwise, Sphider will still download the file before deciding that it cannot handle it.