Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include(SphinxClient.php): failed to open stream: No such file or directory #6

Open
maxodrom opened this issue Aug 11, 2016 · 2 comments

Comments

@maxodrom
Copy link

При такой конфигурации компонента, вылетает Fatal error: "include(SphinxClient.php): failed to open stream: No such file or directory":

'sphinxAPI' => [
            'class' => 'vendor.sergebezborodov.sphinx-yii.ESphinxApiConnection', // sphinx api mode
            //'class' => 'vendor.sergebezborodov.sphinx-yii.ESphinxMysqlConnection', // for sphinx ql mode
            'server' => ['127.0.0.1', 9306],
            'connectionTimeout' => 3, // optional, default 0 - no limit
            'queryTimeout'      => 5, // optional, default 0 - no limit
],

Последюущий вызов в контроллере:

/** @var $sphinx ESphinxMysqlConnection */
$sphinx = Yii::app()->sphinxAPI;
echo '<pre>';
print_r($sphinx);
exit;

Почему не подключается класс SphinxClient? И как решить эту проблему?

@sergebezborodov
Copy link
Owner

приветствую, нужно скачать исходники сфинкса, там в подпапке будет файл sphinxapi.php его нужно заинклудить, в нем и есть реализация класса SphinxClient

@maxodrom
Copy link
Author

maxodrom commented Aug 12, 2016

Это я уже догадался. А нельзя ли зафиксировать этот момент в самом определении класса class ESphinxApiConnection extends ESphinxBaseConnection, включив в самое его начало строчку?

require_once dirname(__FILE__) . '/sphinxapi-2.1.1.php';

class ESphinxApiConnection extends ESphinxBaseConnection {

}

Тогда бы с вашим пакетом поставлялся бы и сам sphinxapi, который бы не требовалось подключать явно. А при отработке конструктора этого класса не было бы Fatal error. Тем более в вашем пакете уже есть такой исходник, который можно было бы использовать по умолчанию.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants