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:

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

$client = (new \Okta\ClientBuilder())
            ->setToken('xxxxxxx-Dcaoyvyla-7ltjTEW4KQQDmHOj9wyr_1')
            ->setOrganizationUrl('https://avanade-theobedouet.okta.com')
            ->build();
?>

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.

Hello!

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

-Brian

1 Like

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