launchdarkly/php-server-sdk

Issues when using windows for development

ObaydaAlesawi opened this issue · 6 comments

Describe the bug
Users and "last reques for the feature" is not logged when using PHP-SDK for windows, it appears that this feature is never been used, but actually, it's used multiple time.

I also noticed that the variation function itself is working, but as I said, the issue is with the logging data for users and last requests for the feature.

To reproduce
Use windows with one of the development environment tools like Laragon (witch I use currently)

Expected behavior
Users should appear in the Dashboard.
The last request for the feature should appear

SDK version
3.7

Language version, developer tools
PHP 7.4, Laragon for development environment

OS/platform
Windows 10

Additional context
It works perfectly in Linux and Mac OS

"Use windows with one of the development environment tools like Laragon" doesn't really count as "steps to reproduce". It'd be much more helpful to say what you actually tried to do with the LaunchDarkly SDK— preferably, with a piece of sample code that we can actually run, which consistently reproduces the problem for you. However, I believe I do know what the problem is.

I was confused at first by the phrase "users and last request for the feature is not logged", since "logged" implied that you were talking about log output from the SDK— but I think what you're saying is that the SDK is failing to send analytics event data to LaunchDarkly, which is where the dashboard data comes from.

The likely cause of this is that the default implementation of event sending, as the API documentation says, is Curl::eventPublisher. That is a Linux-specific implementation, since curl is a Linux command; I would not expect it to work on Windows (unless you have Linux compatibility tools installed). The more portable implementation is Guzzle::eventPublisher. I recommend that you install the Guzzle package and configure your SDK to use this.

It would be fair to ask why the default implementation is not completely portable. The answer is that, at least in the oldest PHP versions that we support, there literally isn't any portable API that supports this type of HTTP request out of the box. If the Guzzle implementation were the default then we would need to require everyone to install Guzzle, which some developers might not want— and, the Guzzle implementation is not ideal because it blocks the PHP process while the request is being sent (whereas the curl implementation runs in the background).

@eli-darkly Thanks for your reply, and sorry for my bad explanation of the problem.
Yes, you are right about the issue.

Do you think that it will work if I installed a curl tool in Windows and registered it as a command?

@Algeneralo It might. It's certainly worth a try and I'll file a reminder for us to test it here as well.

Basically, PHP on Windows isn't a scenario we've looked at much and it's not currently part of our automated test suite. It's a pretty rare use case and so I'm not sure what the issues might be, but it would be a good idea for us to look into it so we can give proper advice.

@Algeneralo in the latest release (v4.1.0), we added support for using Invoke-WebRequest via Powershell when running in a Windows environment. Can you please let us know if this resolves your issue?

Closing due to lack of activity. Please do not hesitate to let us know if the latest release has not addressed your issue.