Help with Elastic and PHP

Hi,

First i want to apologize for my poor english.

Search a solution for my problem by 2 days and still i have no idea how to fix it.

I have 2 places running ES + PHP:

  • Mac Os
  • CentOS (Virtual Box)

To install on linux Centos i am using this tutorial :https://www.saotn.org/install-elasticsearch-on-centos-6-7/

I created my index, mappings and everything works fine on ES.

Linux: When i use curl on terminal linux ES works fine, but when i use curl on php local ES ignore my request.

ES looks like ignore all request by my local script php. When i use my script on Mac Os and search on linux it works.

When i use the same script on linux but search on ES in my MacOs, it works too, so i imagine the problem is on ES linux ignoring my search made on the same local server.

Any ideas?

Thanks and have a great day!

It is likely a SELinux problem. Make sure the non-standard ports are allowed, etc. The default SELinux configuration is to disallow any curl wrapper that hits a non-standard port (such as Elasticsearch's 9200)...you have to explicitly open those when SELinux is in "enforcing" mode.

See the SELinux docs for more details: https://wiki.centos.org/HowTos/SELinux

1 Like

Thanks, Zachary!

You were right, i installed a new version of centos 6.7 and changed the value in file: /etc/selinux/config

SELINUX=enforcing to SELINUX=disabled

Do you have some advise about configuration in production server? Eg: Configuration file (memory, hd space, processor)

You helped me a lot. Thank you very much!

I'm afraid I don't have any recommendations about application servers...it's been a long time since I've done anything like that :slightly_smiling:

For Elasticsearch, the general recommendation is a machine with a good chunk of memory (8-64gb), a few cores and as fast of hard drives as you can afford (e.g. SSD if possible). Actual requirements, particularly space, are highly variable...really depends on your workload.

As an aside, I've seen this SELinux issue a lot in the past, I think I'll add a section to the documentation so that future users will have less difficulty :slight_smile: