Skip to content

Commit fbdfc41

Browse files
forechobestlong
authored andcommitted
feat: Add PHP_FPM_INSTALL_XHPROF as an option to install xhprof extension (laradock#2077)
* feat: Add PHP_FPM_INSTALL_XHPROF as an option to install xhprof extension * fix: INSTALL_XHPROF default value set false
1 parent 7ea44ca commit fbdfc41

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
/nginx/ssl/*.crt
1313
/nginx/ssl/*.key
1414
/nginx/ssl/*.csr
15+
16+
.DS_Store

env-example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true
153153
PHP_FPM_INSTALL_PHPREDIS=true
154154
PHP_FPM_INSTALL_MEMCACHED=false
155155
PHP_FPM_INSTALL_XDEBUG=false
156+
PHP_FPM_INSTALL_XHPROF=false
156157
PHP_FPM_INSTALL_PHPDBG=false
157158
PHP_FPM_INSTALL_IMAP=false
158159
PHP_FPM_INSTALL_MONGO=false

php-fpm/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,34 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
239239
docker-php-ext-enable mongodb \
240240
;fi
241241

242+
###########################################################################
243+
# Xhprof:
244+
###########################################################################
245+
246+
ARG INSTALL_XHPROF=false
247+
248+
RUN if [ ${INSTALL_XHPROF} = true ]; then \
249+
# Install the php xhprof extension
250+
if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \
251+
curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v4.1.6.tar.gz"; \
252+
else \
253+
curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \
254+
fi \
255+
&& mkdir -p xhprof \
256+
&& tar -C xhprof -zxvf /tmp/xhprof.tar.gz --strip 1 \
257+
&& ( \
258+
cd xhprof \
259+
&& phpize \
260+
&& ./configure \
261+
&& make \
262+
&& make install \
263+
) \
264+
&& rm -r xhprof \
265+
&& rm /tmp/xhprof.tar.gz \
266+
;fi
267+
268+
COPY ./xhprof.ini /usr/local/etc/php/conf.d
269+
242270
###########################################################################
243271
# AMQP:
244272
###########################################################################

php-fpm/xhprof.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[xhprof]
2+
; extension=xhprof.so
3+
extension=tideways.so
4+
xhprof.output_dir=/var/www/xhprof
5+
; no need to autoload, control in the program
6+
tideways.auto_prepend_library=0
7+
; set default rate
8+
tideways.sample_rate=100

0 commit comments

Comments
 (0)