Undefined function Okta\posix_getpwuid()

Hi i’m trying to use your okta-sdk-php package, so i tried to initialise a client to see if the module was nicely installed but i got some errors. I’m using php 7.1.9.

my code:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
require 'C:\Users\theo.bedouet\vendor\autoload.php';
use \okta\sdk;

$client = (new \Okta\ClientBuilder())

And i get this message error:

Fatal error: Uncaught Error: Call to undefined function Okta\posix_getpwuid() in C:\Users\theo.bedouet\vendor\okta\sdk\src\ClientBuilder.php:61 Stack trace: #0 C:\wamp64\www\siteOkta\index.php(8): Okta\ClientBuilder->__construct() #1 {main} thrown in C:\Users\theo.bedouet\vendor\okta\sdk\src\ClientBuilder.php on line 61

I’m new to php, but it seems that the module is correctly loaded but there is a problem with one function of your package.

Do someone know how to fix this? Thanks.


This is a known issue with windows based machines. In PHP, we do not have access to the posix_getpwuid function which gives us the local home path for the user running PHP. This is used to define where to look for a configuration file. For now, the only solution until we put a fix in place is to develop using something like Virtual Box or Docker to run your development environment when on windows. You can follow updates on Github in this issue. https://github.com/okta/okta-sdk-php/issues/42


1 Like