Security

Splunk PHP SDK Examples not running due to Login Error: failed to open stream: operation failed

splunknewby
Path Finder

I have been trying to get the Splunk PHP SDK examples to work via XAMPP on ubuntu, and I've run into the following error.

Login Failed.
Reason: fopen(https://localhost:8000/services/auth/login): failed to open stream: operation failed 

I've followed the documentation here: http://dev.splunk.com/view/php-sdk/SP-CAAAEKG
and here: https://github.com/splunk/splunk-sdk-php

According to the latter, the error is due to OpenSSL not being enabled. But even after enabling OpenSSL in the php.ini file, it still continues to show the same error?

Tags (4)
0 Karma
1 Solution

acharlieh
Influencer

It seems strange that you're attempting to connect to port 8000 with the API. By default the Splunk API uses port 8089 (also referred to as the management port). Port 8000 is by default the web interface port (and API clients like the PHP client, Ruby, and Java client need to use the API port and not the web interface port).

Did you change these ports in your Splunk installation or could it be that you're pointing the PHP SDK at the incorrect port?

View solution in original post

acharlieh
Influencer

It seems strange that you're attempting to connect to port 8000 with the API. By default the Splunk API uses port 8089 (also referred to as the management port). Port 8000 is by default the web interface port (and API clients like the PHP client, Ruby, and Java client need to use the API port and not the web interface port).

Did you change these ports in your Splunk installation or could it be that you're pointing the PHP SDK at the incorrect port?

smohamed_splunk
Splunk Employee
Splunk Employee

I totally missed that, this is probably the issue

splunknewby
Path Finder

Cheers that worked.

0 Karma

smohamed_splunk
Splunk Employee
Splunk Employee

Which version of PHP are you using? There is a known issue on PHP 5.6 (and probably 5.6+) that we have a potential workaround for. Please try the change proposed in this pull request and let us know if that works.

edit: the link doesn't seem to be working, here it is https://github.com/splunk/splunk-sdk-php/pull/33

smohamed_splunk
Splunk Employee
Splunk Employee

PHP 5.5 should work just fine

0 Karma

splunknewby
Path Finder

would PHP 5.5.24 work with the setup above?

0 Karma

splunknewby
Path Finder

I keep running into the same issue. I'm using PHP 5.6.8

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...