diff --git a/.gitignore b/.gitignore index affb5c63..06732062 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ /nginx/ssl/*.crt /nginx/ssl/*.key /nginx/ssl/*.csr + +.DS_Store \ No newline at end of file diff --git a/env-example b/env-example index d7bbc988..b5986c19 100644 --- a/env-example +++ b/env-example @@ -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 diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 17a98410..9d90ee68 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -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: ########################################################################### diff --git a/php-fpm/xhprof.ini b/php-fpm/xhprof.ini new file mode 100644 index 00000000..1b010b9f --- /dev/null +++ b/php-fpm/xhprof.ini @@ -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 \ No newline at end of file