mod_php_install.sh: change location of file 'php_errors.log'.

This commit is contained in:
Christoph 2021-01-16 02:28:03 +01:00
parent f87dc94d71
commit 0090c77130

View File

@ -3185,9 +3185,9 @@ EOF
fi
if [ "$_HTTPD_USER" != $FPM_DEFAULT_POOL_LISTEN_OWNER ]; then
if [ "$HTTPD_USER" != $FPM_DEFAULT_POOL_LISTEN_OWNER ]; then
echononl "\tAdd apache user to group \"$FPM_DEFAULT_POOL_LISTEN_GROUP\""
usermod -a -G $FPM_DEFAULT_POOL_LISTEN_GROUP $_HTTPD_USER
usermod -a -G $FPM_DEFAULT_POOL_LISTEN_GROUP $HTTPD_USER
if [ "$?" = "0" ]; then
echo_ok
else
@ -3214,6 +3214,13 @@ $FPM_LOG_DIR/*log {
delaycompress
missingok
notifempty
sharedscripts
postrotate
if [[ -f "${FPM_LOG_DIR}/php_errors.log" ]] ; then
chown ${HTTPD_USER}:$HTTPD_GROUP ${FPM_LOG_DIR}/php_errors.log
fi
[ ! -f $FPM_PID_FILE ]] || kill -USR1 $(cat ${FPM_PID_FILE})
endscript
}
EOF
if [ "$?" = "0" ]; then
@ -3225,6 +3232,24 @@ EOF
echo_skipped
fi
echononl "\tCreate empty logfile '${FPM_LOG_DIR}/php_errors.log'"
touch "${FPM_LOG_DIR}/php_errors.log" > $tmp_err_msg 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
fi
echononl "\tSet owner permission to '${FPM_LOG_DIR}/php_errors.log'"
chown ${HTTPD_USER}:$HTTPD_GROUP "${FPM_LOG_DIR}/php_errors.log" > $tmp_err_msg 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
fi
fi
@ -4033,7 +4058,23 @@ if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then
else
echo_failed
fi
elif [[ $PHP_MAJOR_VERSION -lt 8 ]] ; then
printf "\n" | ${PREFIX_PHP}/bin/pecl install pecl_http-3.2.4 > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo_ok
echononl "\tphp.ini: extension=pecl_http .."
_extension="http.so"
perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
else
echo_failed
fi
else
printf "\n" | ${PREFIX_PHP}/bin/pecl install pecl_http > /dev/null 2>&1
if [ "$?" = "0" ]; then
@ -4709,11 +4750,11 @@ else
fi
## - set error_log = /var/log/apache2/php_errors.log
## - set error_log = ${FPM_LOG_DIR}/php_errors.log
## -
echononl "\tphp.ini: error_log = /var/log/apache2/php_errors.log"
echononl "\tphp.ini: error_log = ${FPM_LOG_DIR}/php_errors.log"
_key="error_log"
_val="/var/log/apache2/php_errors.log"
_val="${FPM_LOG_DIR}/php_errors.log"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?