# Elasticsearch-PHP application not working

**URL:** <https://discuss.elastic.co/t/elasticsearch-php-application-not-working/101618>\
**Category:** Elasticsearch\
**Created:** [September 25, 2017, 1:49am UTC](https://discuss.elastic.co/t/elasticsearch-php-application-not-working/101618 "2017-09-25T01:49:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamA](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@SamA](https://discuss.elastic.co/u/SamA)\
**Post date:** [September 25, 2017, 1:49am UTC](https://discuss.elastic.co/t/elasticsearch-php-application-not-working/101618/1 "2017-09-25T01:49:12Z")

</div>

I have an Elasticsearch-PHP application and it works locally. However, when I put it on an RHEL 6 server that only supports PHP 5.3, it does not work. When I go to the console, I get GET [http://xx.x.xxx.xxx](http://xx.x.xxx.xxx):xxxx/init.php 500 (Internal Server Error). The problem I think might be from a connection issue in the init.php. Here's the code inside init.php:

```
<?php
require_once 'vendor/autoload.php';
use Elasticsearch\ClientBuilder;

/*Build connection*/
$hosts = [
'xx.x.xxx.xxx', // Port
];

$es = ClientBuilder::create() // Instantiate a new ClientBuilder
        ->setHosts($hosts) // Set the hosts
        ->build(); // Build the client object

?>

```

This works perfect locally. I don't know why it doesn't work when I transfer it to the server.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 23, 2017, 1:49am UTC](https://discuss.elastic.co/t/elasticsearch-php-application-not-working/101618/2 "2017-10-23T01:49:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
