美文网首页
docker.skiychan/nginx-php7中编译安装x

docker.skiychan/nginx-php7中编译安装x

作者: 程序猿阿乐 | 来源:发表于2018-08-23 08:52 被阅读0次

    下载xdebug源码

    打开https://xdebug.org/wizard.php,将phpinfo()的内容复制到表单中,最终会分析出我们需要的xdebug版本,

    image.png

    最终得知,本机需要的是xdebug-2.6.1,下载并解压到docker中,并进入相应的目录

    安装编译环境

    从skiychan/nginx-php7的说明中,了解到编译环境的依赖,安装之:

    yum install -y gcc \
        gcc-c++ \
        autoconf \
        automake \
        libtool \
        make \
        cmake
    

    编译

    [root@69e52c4fa4d1 xdebug-2.6.1]# locate phpize
    /usr/local/php/bin/phpize
    [root@69e52c4fa4d1 xdebug-2.6.1]# /usr/local/php/bin/phpize
    ...
    ...
    [root@69e52c4fa4d1 xdebug-2.6.1]# locate php-config
    /usr/local/php/bin/php-config
    [root@69e52c4fa4d1 xdebug-2.6.1]# ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config
    ....
    ....
    [root@69e52c4fa4d1 xdebug-2.6.1]# make
    ...
    Libraries have been installed in:
       /data/www/xdebug-2.6.1/xdebug-2.6.1/modules
    
    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the `-LLIBDIR'
    flag during linking and do at least one of the following:
       - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
         during execution
       - add LIBDIR to the `LD_RUN_PATH' environment variable
         during linking
       - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
       - have your system administrator add LIBDIR to `/etc/ld.so.conf'
    
    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so(8) manual pages.
    ...
    ...
    [root@69e52c4fa4d1 xdebug-2.6.1]# updatedb
    [root@69e52c4fa4d1 xdebug-2.6.1]# locate extensions
    /usr/lib64/python2.7/idlelib/config-extensions.def
    /usr/local/php/include/php/Zend/zend_extensions.h
    /usr/local/php/lib/php/extensions
    /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718
    /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/opcache.a
    /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/opcache.so
    ...
    ...
    [root@69e52c4fa4d1 xdebug-2.6.1]# cd /usr/local/php/lib/php/extensions/
    [root@69e52c4fa4d1 extensions]# ls
    no-debug-non-zts-20170718
    [root@69e52c4fa4d1 extensions]# mkdir xdebug-2.6.1
    [root@69e52c4fa4d1 extensions]# cp /data/www/xdebug-2.6.1/xdebug-2.6.1/modules/xdebug.so xdebug-2.6.1/
    [root@69e52c4fa4d1 extensions]# cd xdebug-2.6.1/
    [root@69e52c4fa4d1 xdebug-2.6.1]# ls
    xdebug.so
    ...
    ...
    [root@69e52c4fa4d1 etc]# /usr/local/php/bin/php -m
    [PHP Modules]
    bcmath
    Core
    ...
    ...
    [root@2ff4ac91b928 /]# locate php.ini
    /usr/local/php/etc/php.ini
    ....
    ....
    插入
    zend_extension = /usr/local/php/lib/php/extensions/xdebug-2.6.1/xdebug.so
    ...
    ...
    [root@69e52c4fa4d1 etc]# /usr/local/php/bin/php -m
    [PHP Modules]
    bcmath
    Core
    ...
    [Zend Modules]
    Xdebug
    [root@69e52c4fa4d1 etc]# ps aux
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root         1  0.0  0.1  11688  2472 ?        Ss   18:17   0:00 /bin/sh /start.sh
    root        11  0.0  0.7 114044 15744 ?        S    18:17   0:00 /usr/bin/python /usr/bin/supervisord -n -c /etc/supervisord.conf
    root        14  0.0  0.8 113808 17048 ?        S    18:17   0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
    root        15  0.0  0.2  45940  5804 ?        S    18:17   0:00 nginx: master process /usr/local/nginx/sbin/nginx
    www         16  0.0  1.2  67552 25080 ?        S    18:17   0:00 nginx: worker process
    www         17  0.0  1.2  67552 25104 ?        S    18:17   0:00 nginx: worker process
    www         18  0.0  1.2  67552 25104 ?        S    18:17   0:00 nginx: worker process
    www         19  0.0  1.2  67552 25080 ?        S    18:17   0:00 nginx: worker process
    www         20  0.0  1.2  67552 24672 ?        S    18:17   0:00 nginx: worker process
    www         21  0.0  1.2  67552 24672 ?        S    18:17   0:00 nginx: worker process
    www         22  0.0  0.7 113872 14812 ?        S    18:17   0:00 php-fpm: pool www
    www         23  0.0  0.7 113872 14864 ?        S    18:17   0:00 php-fpm: pool www
    root        24  0.0  0.1  11828  2980 pts/0    Ss   18:19   0:00 bash
    root      6366  0.0  0.1  51716  3476 pts/0    R+   19:01   0:00 ps aux
    [root@69e52c4fa4d1 etc]# kill -USR2 14
    这时phpinfo()中也有xdebug的信息了
    
    

    相关文章

      网友评论

          本文标题:docker.skiychan/nginx-php7中编译安装x

          本文链接:https://www.haomeiwen.com/subject/ijfpiftx.html