Book Image

Sphinx Search Beginner's Guide

By : Abbas Ali
Book Image

Sphinx Search Beginner's Guide

By: Abbas Ali

Overview of this book

Table of Contents (15 chapters)
Sphinx Search
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface

Time for action - setting up the application


  1. 1. Create a properties directory in your webroot, /path/to/webroot/properties:

    $ mkdir /path/to/webroot/properties
    
  2. 2. Create the /path/to/webroot/properties/views directory:

    $ mkdir /path/to/webroot/properties/views
    
  3. 3. Copy the sphinxapi.php file from the Sphinx source directory to the properties directory:

    $ cp /path/to/sphinx-0.9.9/api/sphinxapi.php /path/to/webroot/properties/
    
  4. 4. Create the file /path/to/webroot/properties/init.php with the following code:

    <?php
    /**
    * File: /path/to/webroot/properties/init.php
    */
    // Database connection credentials
    $dsn ='mysql:dbname=sphinx_properties;host=localhost';
    $user = 'root';
    $pass = '';
    // Instantiate the PDO (PHP 5 specific) class
    try {
    $dbh = new PDO($dsn, $user, $pass);
    } catch (PDOException $e){
    echo'Connection failed: '.$e->getMessage();
    }
    // Array to hold variables to be used in views
    $viewVars = array();
    /**
    * Method to fetch the contents of a view (thtml) file
    * and return the contents...