You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by regany <re...@newzealand.co.nz> on 2009/12/11 12:49:50 UTC

SolrClient::query(): Solr HTTP Error : 'Couldn't connect to server'

hi, I've (hopefully correctly) install the solr php extension.

But I'm receiving the following error when trying to run my test script:

SolrClient::query(): Solr HTTP Error : 'Couldn't connect to server'

Any ideas how to figure out why it's giving the error??

regan


<?php

/* Domain name of the Solr server */
define('SOLR_SERVER_HOSTNAME', 'localhost');

define('SOLR_SERVER_PATH', '/solr/core0');

/* Whether or not to run in secure mode */
define('SOLR_SECURE', false );

/* HTTP Port to connection */
define('SOLR_SERVER_PORT', ((SOLR_SECURE) ? 8443 : 8983));

$options = array(
    'hostname' => SOLR_SERVER_HOSTNAME
    ,'port'     => SOLR_SERVER_PORT
    ,'path'	=> SOLR_SERVER_PATH

);

$client = new SolrClient($options);
$query = new SolrQuery();
$query->setQuery('apple');
$query->setStart(0);
$query->setRows(50);
$query_response = $client->Query($query);
print_r($query_response);
$respose = $query_response->getResponse();
print_r($response);

?>


-- 
View this message in context: http://old.nabble.com/SolrClient%3A%3Aquery%28%29%3A-Solr-HTTP-Error-%3A-%27Couldn%27t-connect-to-server%27-tp26742899p26742899.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: SolrClient::query(): Solr HTTP Error : 'Couldn't connect to server'

Posted by Israel Ekpo <is...@gmail.com>.
On Fri, Dec 11, 2009 at 6:49 AM, regany <re...@newzealand.co.nz> wrote:

>
> hi, I've (hopefully correctly) install the solr php extension.
>
> But I'm receiving the following error when trying to run my test script:
>
> SolrClient::query(): Solr HTTP Error : 'Couldn't connect to server'
>
> Any ideas how to figure out why it's giving the error??
>
> regan
>
>
> <?php
>
> /* Domain name of the Solr server */
> define('SOLR_SERVER_HOSTNAME', 'localhost');
>
> define('SOLR_SERVER_PATH', '/solr/core0');
>
> /* Whether or not to run in secure mode */
> define('SOLR_SECURE', false );
>
> /* HTTP Port to connection */
> define('SOLR_SERVER_PORT', ((SOLR_SECURE) ? 8443 : 8983));
>
> $options = array(
>    'hostname' => SOLR_SERVER_HOSTNAME
>    ,'port'     => SOLR_SERVER_PORT
>    ,'path'     => SOLR_SERVER_PATH
>
> );
>
> $client = new SolrClient($options);
> $query = new SolrQuery();
> $query->setQuery('apple');
> $query->setStart(0);
> $query->setRows(50);
> $query_response = $client->Query($query);
> print_r($query_response);
> $respose = $query_response->getResponse();
> print_r($response);
>
> ?>
>
>
> --
> View this message in context:
> http://old.nabble.com/SolrClient%3A%3Aquery%28%29%3A-Solr-HTTP-Error-%3A-%27Couldn%27t-connect-to-server%27-tp26742899p26742899.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Hi Regan,

I have the following questions:

0. What version of Apache Solr are you using? 1.3, 1.4, nightly builds?

1. What version of PHP are you using and on what operating system?

2. What version of the Solr extension are you using?

3. Which servlet container are you using for Solr? (Jetty, Tomcat, Glass
fish etc)

4. What is the hostname and port numbers and path to Solr? Is your port
number 8080 or 8983

All please let me know what the output of $client->getDebug() is. This
usually contains very detailed errors of what is happening during the
connection.

I would be happy to help you troubleshoot any errors you are having.


-- 
"Good Enough" is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.
http://www.israelekpo.com/