Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
You can get the current error code with function OpenSwoole\Util::getLastErrorCode()
. Optionally, you can translate the error code to be a error message with function OpenSwoole\Util::getErrorMessage()
:
<?php
echo OpenSwoole\Util::getLastErrorCode(OpenSwoole\Util::getLastErrorCode(), 9) . PHP_EOL;
echo OpenSwoole\Util::getErrorMessage(OpenSwoole\Constant::ERROR_MALLOC_FAIL, 9) . PHP_EOL;
Number Error Code Description
1 EPERM Operation not permitted
2 ENOENT No such file or directory
3 ESRCH No such process
4 EINTR Interrupted system call
5 EIO I/O error
6 ENXIO No such device or address
7 E2BIG Argument list too long
8 ENOEXEC Exec format error
9 EBADF Bad file number
10 ECHILD No child processes
11 EAGAIN Try again
12 ENOMEM Out of memory
13 EACCES Permission denied
14 EFAULT Bad address
15 ENOTBLK Block device required
16 EBUSY Device or resource busy
17 EEXIST File exists
18 EXDEV Cross-device link
19 ENODEV No such device
20 ENOTDIR Not a directory
21 EISDIR Is a directory
22 EINVAL Invalid argument
23 ENFILE File table overflow
24 EMFILE Too many open files
25 ENOTTY Not a typewriter
26 ETXTBSY Text file busy
27 EFBIG File too large
28 ENOSPC No space left on device
29 ESPIPE Illegal seek
30 EROFS Read-only file system
31 EMLINK Too many links
32 EPIPE Broken pipe
33 EDOM Math argument out of domain of func
34 ERANGE Math result not representable
35 EDEADLK Resource deadlock would occur
36 ENAMETOOLONG File name too long
37 ENOLCK No record locks available
38 ENOSYS Function not implemented
39 ENOTEMPTY Directory not empty
40 ELOOP Too many symbolic links encountered
42 ENOMSG No message of desired type
43 EIDRM Identifier removed
44 ECHRNG Channel number out of range
45 EL2NSYNC Level 2 not synchronized
46 EL3HLT Level 3 halted
47 EL3RST Level 3 reset
48 ELNRNG Link number out of range
49 EUNATCH Protocol driver not attached
50 ENOCSI No CSI structure available
51 EL2HLT Level 2 halted
52 EBADE Invalid exchange
53 EBADR Invalid request descriptor
54 EXFULL Exchange full
55 ENOANO No anode
56 EBADRQC Invalid request code
57 EBADSLT Invalid slot
59 EBFONT Bad font file format
60 ENOSTR Device not a stream
61 ENODATA No data available
62 ETIME Timer expired
63 ENOSR Out of streams resources
64 ENONET Machine is not on the network
65 ENOPKG Package not installed
66 EREMOTE Object is remote
67 ENOLINK Link has been severed
68 EADV Advertise error
69 ESRMNT Srmount error
70 ECOMM Communication error on send
71 EPROTO Protocol error
72 EMULTIHOP Multihop attempted
73 EDOTDOT RFS specific error
74 EBADMSG Not a data message
75 EOVERFLOW Value too large for defined data type
76 ENOTUNIQ Name not unique on network
77 EBADFD File descriptor in bad state
78 EREMCHG Remote address changed
79 ELIBACC Can not access a needed shared library
80 ELIBBAD Accessing a corrupted shared library
81 ELIBSCN .lib section in a.out corrupted
82 ELIBMAX Attempting to link in too many shared libraries
83 ELIBEXEC Cannot exec a shared library directly
84 EILSEQ Illegal byte sequence
85 ERESTART Interrupted system call should be restarted
86 ESTRPIPE Streams pipe error
87 EUSERS Too many users
88 ENOTSOCK Socket operation on non-socket
89 EDESTADDRREQ Destination address required
90 EMSGSIZE Message too long
91 EPROTOTYPE Protocol wrong type for socket
92 ENOPROTOOPT Protocol not available
93 EPROTONOSUPPORT Protocol not supported
94 ESOCKTNOSUPPORT Socket type not supported
95 EOPNOTSUPP Operation not supported on transport endpoint
96 EPFNOSUPPORT Protocol family not supported
97 EAFNOSUPPORT Address family not supported by protocol
98 EADDRINUSE Address already in use
99 EADDRNOTAVAIL Cannot assign requested address
100 ENETDOWN Network is down
101 ENETUNREACH Network is unreachable
102 ENETRESET Network dropped connection because of reset
103 ECONNABORTED Software caused connection abort
104 ECONNRESET Connection reset by peer
105 ENOBUFS No buffer space available
106 EISCONN Transport endpoint is already connected
107 ENOTCONN Transport endpoint is not connected
108 ESHUTDOWN Cannot send after transport endpoint shutdown
109 ETOOMANYREFS Too many references: cannot splice
110 ETIMEDOUT Connection timed out
111 ECONNREFUSED Connection refused
112 EHOSTDOWN Host is down
113 EHOSTUNREACH No route to host
114 EALREADY Operation already in progress
115 EINPROGRESS Operation now in progress
116 ESTALE Stale NFS file handle
117 EUCLEAN Structure needs cleaning
118 ENOTNAM Not a XENIX named type file
119 ENAVAIL No XENIX semaphores available
120 EISNAM Is a named type file
121 EREMOTEIO Remote I/O error
122 EDQUOT Quota exceeded
123 ENOMEDIUM No medium found
124 EMEDIUMTYPE Wrong medium type
125 ECANCELED Operation Canceled
126 ENOKEY Required key not available
127 EKEYEXPIRED Key has expired
128 EKEYREVOKED Key has been revoked
129 EKEYREJECTED Key was rejected by service
130 EOWNERDEAD Owner died
131 ENOTRECOVERABLE State not recoverable
Number Error Code Description
501 OpenSwoole\Constant::ERROR_MALLOC_FAIL malloc fail
502 OpenSwoole\Constant::ERROR_SYSTEM_CALL_FAIL system call fail
503 OpenSwoole\Constant::ERROR_PHP_FATAL_ERROR php fatal error
504 OpenSwoole\Constant::ERROR_NAME_TOO_LONG name too long
505 OpenSwoole\Constant::ERROR_INVALID_PARAMS invalid params
506 OpenSwoole\Constant::ERROR_QUEUE_FULL queue full
-
700 OpenSwoole\Constant::ERROR_FILE_NOT_EXIST file not exist
701 OpenSwoole\Constant::ERROR_FILE_TOO_LARGE file too large
702 OpenSwoole\Constant::ERROR_FILE_EMPTY file empty
703 OpenSwoole\Constant::ERROR_DNSLOOKUP_DUPLICATE_REQUEST dnslookup duplicate request
704 OpenSwoole\Constant::ERROR_DNSLOOKUP_RESOLVE_FAILED dnslookup resolve failed
705 OpenSwoole\Constant::ERROR_DNSLOOKUP_RESOLVE_TIMEOUT dnslookup resolve timeout
706 OpenSwoole\Constant::ERROR_BAD_IPV6_ADDRESS bad ipv6 address
707 OpenSwoole\Constant::ERROR_UNREGISTERED_SIGNAL unregistered signal
-
1001 OpenSwoole\Constant::ERROR_SESSION_CLOSED_BY_SERVER session closed by server
1002 OpenSwoole\Constant::ERROR_SESSION_CLOSED_BY_CLIENT session closed by client
1003 OpenSwoole\Constant::ERROR_SESSION_CLOSING session closing
1004 OpenSwoole\Constant::ERROR_SESSION_CLOSED session closed
1005 OpenSwoole\Constant::ERROR_SESSION_NOT_EXIST session not exist
1006 OpenSwoole\Constant::ERROR_SESSION_INVALID_ID session invalid id
1007 OpenSwoole\Constant::ERROR_SESSION_DISCARD_TIMEOUT_DATA session discard timeout data
1008 OpenSwoole\Constant::ERROR_OUTPUT_BUFFER_OVERFLOW output buffer overflow
1009 OpenSwoole\Constant::ERROR_SSL_NOT_READY ssl not ready
1010 OpenSwoole\Constant::ERROR_SSL_CANNOT_USE_SENFILE ssl cannot use senfile
1011 OpenSwoole\Constant::ERROR_SSL_EMPTY_PEER_CERTIFICATE ssl empty peer certificate
1012 OpenSwoole\Constant::ERROR_SSL_VEFIRY_FAILED ssl vefiry failed
1013 OpenSwoole\Constant::ERROR_SSL_BAD_CLIENT ssl bad client
1014 OpenSwoole\Constant::ERROR_SSL_BAD_PROTOCOL ssl bad protocol
-
1201 OpenSwoole\Constant::ERROR_PACKAGE_LENGTH_TOO_LARGE package length too large
1202 OpenSwoole\Constant::ERROR_DATA_LENGTH_TOO_LARGE data length too large
-
2001 OpenSwoole\Constant::ERROR_TASK_PACKAGE_TOO_BIG task package too big
2002 OpenSwoole\Constant::ERROR_TASK_DISPATCH_FAIL task dispatch fail
-
3001 OpenSwoole\Constant::ERROR_HTTP2_STREAM_ID_TOO_BIG http2 stream id too big
3002 OpenSwoole\Constant::ERROR_HTTP2_STREAM_NO_HEADER http2 stream no header
3003 OpenSwoole\Constant::ERROR_HTTP2_STREAM_NOT_FOUND http2 stream not found
-
4001 OpenSwoole\Constant::ERROR_AIO_BAD_REQUEST Raio bad request
4002 OpenSwoole\Constant::ERROR_AIO_CANCELED aio canceled
-
5001 OpenSwoole\Constant::ERROR_CLIENT_NO_CONNECTION client no connection
5002 OpenSwoole\Constant::ERROR_SOCKET_CLOSED socket closed
7001 OpenSwoole\Constant::ERROR_SOCKS5_UNSUPPORT_VERSION socks5 unsupport version
7002 OpenSwoole\Constant::ERROR_SOCKS5_UNSUPPORT_METHOD socks5 unsupport method
7003 OpenSwoole\Constant::ERROR_SOCKS5_AUTH_FAILED socks5 auth failed
7004 OpenSwoole\Constant::ERROR_SOCKS5_SERVER_ERROR socks5 server error
-
8001 OpenSwoole\Constant::ERROR_HTTP_PROXY_HANDSHAKE_ERROR http proxy handshake error
8002 OpenSwoole\Constant::ERROR_HTTP_INVALID_PROTOCOL http invalid protocol
-
8501 OpenSwoole\Constant::ERROR_WEBSOCKET_BAD_CLIENT websocket bad client
8502 OpenSwoole\Constant::ERROR_WEBSOCKET_BAD_OPCODE websocket bad opcode
8503 OpenSwoole\Constant::ERROR_WEBSOCKET_UNCONNECTED websocket unconnected
8504 OpenSwoole\Constant::ERROR_WEBSOCKET_HANDSHAKE_FAILED websocket handshake failed
-
9001 OpenSwoole\Constant::ERROR_SERVER_MUST_CREATED_BEFORE_CLIENT server must created before client
9002 OpenSwoole\Constant::ERROR_SERVER_TOO_MANY_SOCKET server too many socket
9003 OpenSwoole\Constant::ERROR_SERVER_WORKER_TERMINATED server worker terminated
9004 OpenSwoole\Constant::ERROR_SERVER_INVALID_LISTEN_PORT server invalid listen port
9005 OpenSwoole\Constant::ERROR_SERVER_TOO_MANY_LISTEN_PORT server too many listen port
9006 OpenSwoole\Constant::ERROR_SERVER_PIPE_BUFFER_FULL server pipe buffer full
9007 OpenSwoole\Constant::ERROR_SERVER_NO_IDLE_WORKER server no idle worker
9008 OpenSwoole\Constant::ERROR_SERVER_ONLY_START_ONE server only start one
9009 OpenSwoole\Constant::ERROR_SERVER_SEND_IN_MASTER server send in master
9010 OpenSwoole\Constant::ERROR_SERVER_INVALID_REQUEST server invalid request
9011 OpenSwoole\Constant::ERROR_SERVER_WORKER_EXIT_TIMEOUT server worker exit timeout
-
10001 OpenSwoole\Constant::ERROR_CO_OUT_OF_COROUTINE coroutine out of coroutine
10002 OpenSwoole\Constant::ERROR_CO_HAS_BEEN_BOUND coroutine has been bound
10003 OpenSwoole\Constant::ERROR_CO_MUTEX_DOUBLE_UNLOCK coroutine mutex double unlock
10004 OpenSwoole\Constant::ERROR_CO_BLOCK_OBJECT_LOCKED coroutine block object locked
10005 OpenSwoole\Constant::ERROR_CO_BLOCK_OBJECT_WAITING coroutine block object waiting
10006 OpenSwoole\Constant::ERROR_CO_YIELD_FAILED coroutine yield failed
10007 OpenSwoole\Constant::ERROR_CO_GETCONTEXT_FAILED coroutine getcontext failed
10008 OpenSwoole\Constant::ERROR_CO_SWOOLEAPCONTEXT_FAILED coroutine swapcontext failed
10009 OpenSwoole\Constant::ERROR_CO_MAKECONTEXT_FAILED coroutine makecontext failed
10010 OpenSwoole\Constant::ERROR_CO_IOCPINIT_FAILED coroutine iocpinit failed
10011 OpenSwoole\Constant::ERROR_CO_PROTECT_STACK_FAILED coroutine protect stack failed
10012 OpenSwoole\Constant::ERROR_CO_STD_THREAD_LINK_ERROR coroutine std thread link error
10013 OpenSwoole\Constant::ERROR_CO_DISABLED_MULTI_THREAD coroutine disabled multi thread