posix_strerror
Description
The posix_strerror of POSIX for PHP retrieves the system error message associated with the given errno.
Syntax
posix_strerror( int $error_code ): string
Parameters
error_code
A POSIX error number, returned by posix_get_last_error(). If set to 0, then the string "Success" is returned.
Return
Returns the error message, as a string.
Examples
1 · error_code · 0
<? $error_code = posix_get_last_error(); $return = posix_strerror($error_code); echo $return;
Success
2 · error_code · 1
<? $process_id = 100; $signal = SIGKILL; posix_kill($process_id, $signal); $error_code = posix_get_last_error(); $return = posix_strerror($error_code); echo $return;
Operation not permitted
3 · error_code · 3
<? $process_id = 100000; $signal = SIGKILL; posix_kill($process_id, $signal); $error_code = posix_get_last_error(); $return = posix_strerror($error_code); echo $return;
No such process
4 · error_code · 13
<? $filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt'; $flags = POSIX_X_OK; posix_access($filename, $flags); $error_code = posix_get_last_error(); $return = posix_strerror($error_code); echo $return;
Permission denied
Links
POSIX
- posix_access
- posix_ctermid
- posix_eaccess
- posix_errno
- posix_fpathconf
- posix_get_last_error
- posix_getcwd
- posix_getegid
- posix_geteuid
- posix_getgid
- posix_getgrgid
- posix_getgrnam
- posix_getgroups
- posix_getlogin
- posix_getpgid
- posix_getpgrp
- posix_getpid
- posix_getppid
- posix_getpwnam
- posix_getpwuid
- posix_getrlimit
- posix_getsid
- posix_getuid
- posix_initgroups
- posix_isatty
- posix_kill
- posix_mkfifo
- posix_mknod
- posix_pathconf
- posix_setegid
- posix_seteuid
- posix_setgid
- posix_setpgid
- posix_setrlimit
- posix_setsid
- posix_setuid
- posix_sysconf
- posix_times
- posix_ttyname
- posix_uname