feat: Add PHP_FPM_INSTALL_XHPROF as an option to install xhprof extension (#2077)

* feat: Add PHP_FPM_INSTALL_XHPROF as an option to install xhprof extension
* fix: INSTALL_XHPROF default value set false
This commit is contained in:
蔡正海 2019-05-18 10:57:01 +08:00 committed by Shao Yu-Lung (Allen)
parent 7ea44ca25a
commit fbdfc41927
4 changed files with 39 additions and 0 deletions

2
.gitignore vendored
View File

@ -12,3 +12,5 @@
/nginx/ssl/*.crt
/nginx/ssl/*.key
/nginx/ssl/*.csr
.DS_Store

View File

@ -153,6 +153,7 @@ PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true
PHP_FPM_INSTALL_PHPREDIS=true
PHP_FPM_INSTALL_MEMCACHED=false
PHP_FPM_INSTALL_XDEBUG=false
PHP_FPM_INSTALL_XHPROF=false
PHP_FPM_INSTALL_PHPDBG=false
PHP_FPM_INSTALL_IMAP=false
PHP_FPM_INSTALL_MONGO=false

View File

@ -239,6 +239,34 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
docker-php-ext-enable mongodb \
;fi
###########################################################################
# Xhprof:
###########################################################################
ARG INSTALL_XHPROF=false
RUN if [ ${INSTALL_XHPROF} = true ]; then \
# Install the php xhprof extension
if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \
curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v4.1.6.tar.gz"; \
else \
curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \
fi \
&& mkdir -p xhprof \
&& tar -C xhprof -zxvf /tmp/xhprof.tar.gz --strip 1 \
&& ( \
cd xhprof \
&& phpize \
&& ./configure \
&& make \
&& make install \
) \
&& rm -r xhprof \
&& rm /tmp/xhprof.tar.gz \
;fi
COPY ./xhprof.ini /usr/local/etc/php/conf.d
###########################################################################
# AMQP:
###########################################################################

8
php-fpm/xhprof.ini Normal file
View File

@ -0,0 +1,8 @@
[xhprof]
; extension=xhprof.so
extension=tideways.so
xhprof.output_dir=/var/www/xhprof
; no need to autoload, control in the program
tideways.auto_prepend_library=0
; set default rate
tideways.sample_rate=100