0

I followed all the steps in this guide, and have successfully installed Sphinx on my Ubuntu 14.04 server. However, I am not able to use SphinxQL (by Foolz) in my php pages. This is the code I am using :

<?php

use Foolz\SphinxQL\Connection;
use Foolz\SphinxQL\SphinxQL;
 
$conn = new Connection();
$conn->setParams(array('host' => 'localhost', 'port' => 9306));
 
$query = SphinxQL::create($conn)
->select('*')
->from('documents')
->match('desc', 'testing');
 

$result = $query->execute();

This gives me a "Fatal error: Class 'Foolz\SphinxQL\Connection' not found".

Sphinx is installed in the /etc/sphinxsearch/ directory.

Community
  • 1
  • 1
Sainath Krishnan
  • 2,089
  • 7
  • 28
  • 43
  • Did you use composer to install https://github.com/FoolCode/SphinxQL-Query-Builder ? Ie so can use composer autoload? – barryhunter Apr 28 '15 at 22:32
  • Yep, that is exactly what I did! – Sainath Krishnan Apr 29 '15 at 01:41
  • Im fairly certain this has something to do with the namespace... I've tried multiple options, all of them lead to class not found :\ – Sainath Krishnan Apr 29 '15 at 10:50
  • Have you actually setup the autoloader? https://getcomposer.org/doc/01-basic-usage.md#autoloading – barryhunter Apr 29 '15 at 12:31
  • Apologies for the delay, and yes I followed all instructions on that page. Im not too familiar with composer, so I'm not entirely sure how to debug this either – Sainath Krishnan Apr 29 '15 at 22:52
  • Does the actual sphinx installation need to be in the project folder? – Sainath Krishnan Apr 30 '15 at 14:54
  • Look at the bootstrap file: https://github.com/FoolCode/SphinxQL-Query-Builder/blob/master/tests/bootstrap.php it shows how to use autoload.php – barryhunter Apr 30 '15 at 19:45
  • Hello, did you try ` – Woxxy Jun 25 '15 at 15:11
  • The problem is on PHP side, specifically with the autoloader. It does not matter how you installed Sphinxsearch at this point. – MartyIX Oct 21 '15 at 13:05
  • I am seeing the same problem. For me the autoloader (function findFileWithExtension) is trying to find the file at /mnt/i/var/www/vhosts/my.play.net/sphinx/vendor/composer/../foolz/sphinxql-query-builder/Connection.php when it should presumably be looking in /mnt/i/var/www/vhosts/my.play.net/sphinx/vendor/composer/../foolz/sphinxql-query-builder/Drivers/Mysqli/Connection.php ? – Nick Weavers Mar 04 '19 at 17:47

0 Answers0