# Using Elasticsearch 7.2 with older version of PHP possible?

**URL:** <https://discuss.elastic.co/t/using-elasticsearch-7-2-with-older-version-of-php-possible/189066>\
**Category:** Elasticsearch\
**Created:** [July 5, 2019, 10:17am UTC](https://discuss.elastic.co/t/using-elasticsearch-7-2-with-older-version-of-php-possible/189066 "2019-07-05T10:17:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aj\_potc](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aj\_potc](https://discuss.elastic.co/u/aj_potc)\
**Post date:** [July 5, 2019, 10:17am UTC](https://discuss.elastic.co/t/using-elasticsearch-7-2-with-older-version-of-php-possible/189066/1 "2019-07-05T10:17:15Z")

</div>

I've installed Elasticsearch 7.2 on CentOS 7. I'd like to try using the Elasticsearch-PHP API, but the only version compatible with Elasticsearch 7.2 doesn't support PHP 5.4, the standard PHP version in CentOS 7.

Now, I fully realize that PHP 5.4 is ancient, but I'd like to stick with it for compatibility reasons and because it's the official version supported by my distro. Is there any method that would allow me to use the Elasticsearch-PHP API with such an old PHP version?

Alternatively, is there another good way I can access Elasticsearch with PHP other than by using the official API? I know that I can use `curl` to make HTTP requests, but my impression is that this is more for testing than for real-world use.

Thanks very much for any suggestions!

---

<div class="post-metadata">

**Author:** ![ezimuel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezimuel/32/49516_2.png) [@ezimuel](https://discuss.elastic.co/u/ezimuel)\
**Post date:** [July 5, 2019, 1:19pm UTC](https://discuss.elastic.co/t/using-elasticsearch-7-2-with-older-version-of-php-possible/189066/2 "2019-07-05T13:19:23Z")

</div>

Hi @aj_potc, I'm the maintainer of elasticsearch-php client. The latest version is 7.0.2 that supports Elasticsearch 7.0 and 7.1. I'm working to release elasticsearch-php 7-2-0 soon to be 100% compatible with Elasticsearch 7.2.  
That said, the minimum PHP version is 7.1 for running this client. This because PHP 7.0 has reached EOL on 1st Jan 2019. There's actually no way to run elasticsearch-php 7 on PHP 5, we used the feature of PHP 7 like type hint in the client. The only version that runs on PHP 5.6 is elasticsearch-php 5.x but I don't suggest to use it since it's outdated and only tested with Elasticsearch 5.  
I suggest to update the PHP version on your CentOS, there are many references on how to do this in a couple of commands, for instance: [https://linuxize.com/post/install-php-7-on-centos-7/](https://linuxize.com/post/install-php-7-on-centos-7/)

---

<div class="post-metadata">

**Author:** ![aj\_potc](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aj\_potc](https://discuss.elastic.co/u/aj_potc)\
**Post date:** [July 5, 2019, 2:02pm UTC](https://discuss.elastic.co/t/using-elasticsearch-7-2-with-older-version-of-php-possible/189066/3 "2019-07-05T14:02:19Z")

</div>

Hi Enrico,

Thanks very much for your reply. It sounds like what I want to do is impossible, then.

I am planning to migrate to CentOS 8 in the future, which uses PHP 7.2. I suppose I'll have to put off any switch to Elasticsearch until then. Right now I can't simply update from PHP 5.4 to 7.x without risking breakage in applications. All of those will need to be migrated, of course.

Thanks again.

---

<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:** [August 2, 2019, 2:02pm UTC](https://discuss.elastic.co/t/using-elasticsearch-7-2-with-older-version-of-php-possible/189066/4 "2019-08-02T14:02:22Z")

</div>

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