1

I have problem with start Solarium Client, I downloaded it by Composer and GitHub according the wiki tutorial, it's ok, but I don't know what I must do now.

When I tried this example code:

<?php

require(__DIR__.'/init.php');
htmlHeader();

// check solarium version available
echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - ';

// create a client instance
$client = new Solarium\Client($config);

// create a ping query
$ping = $client->createPing();

// execute the ping query
try {
    $result = $client->ping($ping);
    echo 'Ping query successful';
    echo '<br/><pre>';
    var_dump($result->getData());
    echo '</pre>';
} catch (Solarium\Exception $e) {
    echo 'Ping query failed';
}

htmlFooter();

I have the following error:

Warning: require(C:\xampp\htdocs\solarium/init.php): failed to open stream: No such    file or directory in C:\xampp\htdocs\solarium\test.php on line 3

Fatal error: require(): Failed opening required 'C:\xampp\htdocs\solarium/init.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\solarium\test.php on line 3

I use Xampp server.

Must I set some Path, where appropriate, how and where? File init.php is in folder: C:\xampp\htdocs\solarium\vendor\solarium\solarium\examples\ and i start the demo file in folder: C:\xampp\htdocs\solarium\

Sorry for my English. Thank you for help.

Joël Salamin
  • 3,538
  • 3
  • 22
  • 33
tomas
  • 153
  • 2
  • 13

1 Answers1

2

You have to run solarium examples, and examples derived form them like your test.php file, from the /examples directory in the solarium directory tree.

In this directory there is init.php file which is setting up 'display_errors' init variable, loading composer created autoload.php, loading the config.php and defining htmlHeader() and htmlFooter() functions.

Marin Purgar
  • 189
  • 2
  • 11