phpDocumentor

MydbEnvironment
in package
implements MydbEnvironmentInterface

Tags
author

Sergei Shilko contact@sshilko.com

license

https://opensource.org/licenses/mit-license.php MIT

see
https://github.com/sshilko/php-sql-mydb

Table of Contents

Interfaces

MydbEnvironmentInterface

Properties

$knownSignals  : array<string|int, int>
$trappedHandlers  : array<string|int, mixed>
Backup of signal handlers Original signal handler, which replaced by custon trap
$trappedSignals  : array<string|int, int>
Any signals that were trapped during custom signal handler

Methods

endSignalsTrap()  : array<string|int, int>|null
Disable custom signal handler
error_reporting()  : int
Sets which PHP errors are reported
gc_collect_cycles()  : void
ignore_user_abort()  : int
Set whether a client disconnect should abort script execution (does not affect CLI)
ini_set()  : string
Sets the value of a configuration option
restore_error_handler()  : void
Restore previous PHP error handler
set_error_handler()  : void
Set custom PHP error handler
setMysqlndNetReadTimeout()  : bool
Set mysqlnd.net_read_timeout php ini value
startSignalsTrap()  : void
Enable custom signal handler
getNullErrorHandler()  : callable
Error handler that does nothing and does not chain

Properties

$knownSignals

protected array<string|int, int> $knownSignals = [\SIGTERM, \SIGINT, \SIGHUP]

$trappedHandlers

Backup of signal handlers Original signal handler, which replaced by custon trap

protected array<string|int, mixed> $trappedHandlers = []
Tags
psalm-var

array<int, int|resource|string>

$trappedSignals

Any signals that were trapped during custom signal handler

protected array<string|int, int> $trappedSignals = []

Methods

set_error_handler()

Set custom PHP error handler

public set_error_handler([callable|null $callback = null ][, int $error_levels = E_ALL | E_STRICT ]) : void
Parameters
$callback : callable|null = null
$error_levels : int = E_ALL | E_STRICT
Tags
see
https://www.php.net/manual/en/function.set-error-handler
SuppressWarnings

("camelCase")

phpcs:disable

PSR1.Methods.CamelCapsMethodName.NotCamelCaps

setMysqlndNetReadTimeout()

Set mysqlnd.net_read_timeout php ini value

public setMysqlndNetReadTimeout(string $timeoutSeconds) : bool

mysqlnd and the MySQL Client Library, libmysqlclient use different networking APIs. mysqlnd uses PHP streams, whereas libmysqlclient uses its own wrapper around the operating level network calls. PHP, by default, sets a read timeout of 60s for streams. This is set via php.ini, default_socket_timeout. This default applies to all streams that set no other timeout value. mysqlnd does not set any other value and therefore connections of long running queries can be disconnected after default_socket_timeout seconds resulting in an error message 2006 - MySQL Server has gone away. The MySQL Client Library sets a default timeout of 24 * 3600 seconds (1 day) and waits for other timeouts to occur, such as TCP/IP timeouts. mysqlnd now uses the same very long timeout. The value is configurable through a new php.ini setting: mysqlnd.net_read_timeout.

mysqlnd.net_read_timeout gets used by any extension (ext/mysql, ext/mysqli, PDO_MySQL) that uses mysqlnd. mysqlnd tells PHP Streams to use mysqlnd.net_read_timeout. Please note that there may be subtle differences between MYSQL_OPT_READ_TIMEOUT from the MySQL Client Library and PHP Streams, for example MYSQL_OPT_READ_TIMEOUT is documented to work only for TCP/IP connections and, prior to MySQL 5.1.2, only for Windows. PHP streams may not have this limitation.

Parameters
$timeoutSeconds : string
Tags
throws
EnvironmentException
see
https://www.php.net/manual/en/mysqlnd.config.php
Return values
bool

        
On this page

Search results