feat: set php mysqli socket to user provided value

This commit is contained in:
Marks Sunins 2025-05-15 09:41:26 +00:00
parent 537b5373e1
commit de0d18784a
No known key found for this signature in database
GPG Key ID: BADED4DBFD15F1A2
8 changed files with 28 additions and 12 deletions

View File

@ -34,3 +34,6 @@ php_value[date.timezone] = ${PHP_TZ}
; PHP-FPM monitoring
pm.status_path = /status
ping.path = /ping
; Set the socket equal to DB_SERVER_SOCKET set by user
php_value[mysqli.default_socket] = ${DB_SERVER_SOCKET}

View File

@ -68,12 +68,12 @@ file_env() {
# Check prerequisites for MySQL database
check_variables() {
: ${DB_SERVER_PORT:="3306"}
if [ -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
DB_SERVER_HOST="localhost"
else
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
fi
@ -213,8 +213,9 @@ prepare_zbx_php_config() {
export PHP_TZ=${PHP_TZ}
export DB_SERVER_TYPE="MYSQL"
export DB_SERVER_HOST=${DB_SERVER_HOST}
export DB_SERVER_PORT=${DB_SERVER_PORT}
test -z "${DB_SERVER_HOST}" || export DB_SERVER_HOST
test -z "${DB_SERVER_PORT}" || export DB_SERVER_PORT
test -z "${DB_SERVER_SOCKET}" || export DB_SERVER_SOCKET
export DB_SERVER_DBNAME=${DB_SERVER_DBNAME}
export DB_SERVER_SCHEMA=${DB_SERVER_SCHEMA}
export DB_SERVER_USER=${DB_SERVER_ZBX_USER}

View File

@ -34,3 +34,6 @@ php_value[date.timezone] = ${PHP_TZ}
; PHP-FPM monitoring
pm.status_path = /status
ping.path = /ping
; Set the socket equal to DB_SERVER_SOCKET set by user
php_value[mysqli.default_socket] = ${DB_SERVER_SOCKET}

View File

@ -68,12 +68,12 @@ file_env() {
# Check prerequisites for MySQL database
check_variables() {
: ${DB_SERVER_PORT:="3306"}
if [ -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
DB_SERVER_HOST="localhost"
else
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
fi
@ -213,8 +213,9 @@ prepare_zbx_php_config() {
export PHP_TZ=${PHP_TZ}
export DB_SERVER_TYPE="MYSQL"
export DB_SERVER_HOST=${DB_SERVER_HOST}
export DB_SERVER_PORT=${DB_SERVER_PORT}
test -z "${DB_SERVER_HOST}" || export DB_SERVER_HOST
test -z "${DB_SERVER_PORT}" || export DB_SERVER_PORT
test -z "${DB_SERVER_SOCKET}" || export DB_SERVER_SOCKET
export DB_SERVER_DBNAME=${DB_SERVER_DBNAME}
export DB_SERVER_SCHEMA=${DB_SERVER_SCHEMA}
export DB_SERVER_USER=${DB_SERVER_ZBX_USER}

View File

@ -34,3 +34,6 @@ php_value[date.timezone] = ${PHP_TZ}
; PHP-FPM monitoring
pm.status_path = /status
ping.path = /ping
; Set the socket equal to DB_SERVER_SOCKET set by user
php_value[mysqli.default_socket] = ${DB_SERVER_SOCKET}

View File

@ -68,12 +68,12 @@ file_env() {
# Check prerequisites for MySQL database
check_variables() {
: ${DB_SERVER_PORT:="3306"}
if [ -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
DB_SERVER_HOST="localhost"
else
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
fi
@ -213,8 +213,9 @@ prepare_zbx_php_config() {
export PHP_TZ=${PHP_TZ}
export DB_SERVER_TYPE="MYSQL"
export DB_SERVER_HOST=${DB_SERVER_HOST}
export DB_SERVER_PORT=${DB_SERVER_PORT}
test -z "${DB_SERVER_HOST}" || export DB_SERVER_HOST
test -z "${DB_SERVER_PORT}" || export DB_SERVER_PORT
test -z "${DB_SERVER_SOCKET}" || export DB_SERVER_SOCKET
export DB_SERVER_DBNAME=${DB_SERVER_DBNAME}
export DB_SERVER_SCHEMA=${DB_SERVER_SCHEMA}
export DB_SERVER_USER=${DB_SERVER_ZBX_USER}

View File

@ -34,3 +34,6 @@ php_value[date.timezone] = ${PHP_TZ}
; PHP-FPM monitoring
pm.status_path = /status
ping.path = /ping
; Set the socket equal to DB_SERVER_SOCKET set by user
php_value[mysqli.default_socket] = ${DB_SERVER_SOCKET}

View File

@ -68,12 +68,12 @@ file_env() {
# Check prerequisites for MySQL database
check_variables() {
: ${DB_SERVER_PORT:="3306"}
if [ -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
DB_SERVER_HOST="localhost"
else
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
fi
@ -213,8 +213,9 @@ prepare_zbx_php_config() {
export PHP_TZ=${PHP_TZ}
export DB_SERVER_TYPE="MYSQL"
export DB_SERVER_HOST=${DB_SERVER_HOST}
export DB_SERVER_PORT=${DB_SERVER_PORT}
test -z "${DB_SERVER_HOST}" || export DB_SERVER_HOST
test -z "${DB_SERVER_PORT}" || export DB_SERVER_PORT
test -z "${DB_SERVER_SOCKET}" || export DB_SERVER_SOCKET
export DB_SERVER_DBNAME=${DB_SERVER_DBNAME}
export DB_SERVER_SCHEMA=${DB_SERVER_SCHEMA}
export DB_SERVER_USER=${DB_SERVER_ZBX_USER}