PHP Fatal error: Call to undefined function posix_getpwuid()

I found that this error appears rather often online but almost no one has any idea why it would come up.  I found this error myself today while doing an install of FreePBX on Fedora 14.  My full error was:

Checking user..PHP Fatal error:  Call to undefined function posix_getpwuid() in /usr/src/freepbx-2.8.1/install_amp on line 728

This seems like it must be a permissions error.  But more than likely you are simply missing the PHP Posix library.  You can resolve this on Fedora with

yum -y install php-posix

Ta da!

8 thoughts on “PHP Fatal error: Call to undefined function posix_getpwuid()”

  1. I just updated my PBX in a Flash system, rebooted my server, and had a similar problem:

    [[email protected] /]# amportal start

    PHP Fatal error: Call to undefined function posix_getpwuid() in /var/lib/asterisk/bin/gen_amp_conf.php on line 3
    **** WARNING: ERROR IN CONFIGURATION ****
    astrundir in ‘/etc/asterisk’ is set to but the directory
    does not exists. Attempting to create it with: ‘mkdir -p ‘

    mkdir: missing operand
    Try `mkdir –help’ for more information.
    **** ERROR: COULD NOT CREATE ****
    Attempt to execute ‘mkdir -p ‘ failed with an exit code of 1
    You must create this directory and the try again.

    I just disabled the following lines of /var/lib/asterisk/bin/gen_amp_conf.php and it works now.

    // $current_user = posix_getpwuid(posix_geteuid());
    // if ($current_user[‘uid’] !== 0) {
    // die(‘Forbidden – must be root’);
    // }

  2. Thank You very, very much that you wanted to write this 🙂 So simple solution… And it works of course

Leave a Reply