25

POSIX does not appear when I run php -m cmd, however, I see it from the phpinfo() –enable-posix=shared on Linux with Plesk 9.

Basically, I can't use posix_*() functions as described at http://www.php.net/manual/en/ref.posix.php

this shows doesn't exists:

if (function_exists('posix_getuid')) {
    echo "posix_getuid available";
} else {
    echo "posix_getuid not available"; // this prints in my server.
}

Could someone show me how to install it? Thank you.

[PHP Modules]
bz2
calendar
ctype
curl
date
dbase
dom
exif
fileinfo
filter
ftp
gd
geoip
gettext
gmp
hash
iconv
imap
ionCube Loader
json
libxml
mbstring
mcrypt
memcache
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib
Hauleth
  • 22,873
  • 4
  • 61
  • 112
Nizzy
  • 1,879
  • 3
  • 21
  • 33

3 Answers3

50

I found the solution:

yum install php-process

This package enables php-posix.

Pavel Strakhov
  • 39,123
  • 5
  • 88
  • 127
Nizzy
  • 1,879
  • 3
  • 21
  • 33
  • 1
    BTW - if you're using a typical amazon AMI you will want this package for System_Daemon in pear to work correctly. – Ross Aug 20 '12 at 15:42
  • The php-process package name depends on your running php version such as `php56w-process.x86_64`, `php71w-process.x86_64`. – Nick Tsai Jul 03 '17 at 02:51
4

While resolved, the original problem would seem to be that posix_getpwuid is not supported on Windows:

from: http://www.php.net/manual/en/function.posix-getpwuid.php

On Windows, posix_getpwuid() is not implemented

  • if you just want the username of the current user, you can use get_current_user().

  • To properly get the running user, test if function_exists('posix_getpwuid') and if not, assume you're running on Windows and call getenv('USERNAME').

Peter O.
  • 32,158
  • 14
  • 82
  • 96
elpatron
  • 41
  • 1
  • Your answer is completely unrelated to the question, I think. The problem occurred on Linux, and the used function was a different one. – Sven Nov 07 '12 at 22:25
1

In openSUSE use command zypper install php-posix for installing php-process for using php function posix_getuid

Harikrishnan
  • 9,688
  • 11
  • 84
  • 127