Using Elasticsearch 7.2 with older version of PHP possible?

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!

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/

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.

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