php 如何在php中安装posix
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2197366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to install posix in php
提问by Nizzy
POSIX does not appear when I run php -m cmd, however, I see it from the phpinfo()–enable-posix=sharedon Linux with Plesk 9.
POSIX 在我运行时没有出现php -m cmd,但是,我phpinfo()–enable-posix=shared在带有 Plesk 9 的 Linux 上看到了它。
Basically, I can't use posix_*()functions as described at
http://www.php.net/manual/en/ref.posix.php
基本上,我不能使用http://www.php.net/manual/en/ref.posix.php 中posix_*()描述的函数
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
回答by Nizzy
I found the solution:
我找到了解决方案:
yum install php-process
This package enables php-posix.
这个包启用了 php-posix。
回答by elpatron
While resolved, the original problem would seem to be that posix_getpwuidis not supported on Windows:
解决后,最初的问题似乎posix_getpwuid是 Windows 不支持:
from: http://www.php.net/manual/en/function.posix-getpwuid.php
来自:http: //www.php.net/manual/en/function.posix-getpwuid.php
On Windows, posix_getpwuid()is not implemented
在 Windows 上,posix_getpwuid()未实现
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 callgetenv('USERNAME').
如果你只想要当前用户的用户名,你可以使用
get_current_user().要正确获取正在运行的用户,请测试是否存在
function_exists('posix_getpwuid'),如果没有,假设您在 Windows 上运行并调用getenv('USERNAME').
回答by Harikrishnan
In openSUSE use command zypper install php-posixfor installing php-process for using php function posix_getuid
在 openSUSE 中使用命令zypper install php-posix安装 php-process 以使用 php 功能posix_getuid

