PHP 编译参数

标签: none



php7编译参数

./configure \
--prefix=/usr/local/php7 \
--exec-prefix=/usr/local/php7 \
--bindir=/usr/local/php7/bin \
--sbindir=/usr/local/php7/sbin \
--includedir=/usr/local/php7/include \
--libdir=/usr/local/php7/lib/php \
--mandir=/usr/local/php7/php/man \
--with-config-file-path=/usr/local/php7/etc \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-mhash \
--with-mysqli \
--with-pdo-mysql \
--with-gd \
--with-iconv \
--with-zlib \
--with-openssl \
--enable-zip \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir \
--enable-opcache \
--enable-fpm -\
-with-fpm-user=php-fpm \
--with-fpm-group=php-fpm \
--without-gdbm \
--enable-exif \
--with-apxs2=/usr/bin/apxs

phpize为php添加exif扩展库

1.进入exif扩展库目录
#cd /root/php-7.2.0/ext/exif

2.调用phpize程序生成编译配置文件(如果不在扩展库目录下执行phpize命令会报错!i)

[root@localhost exif]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718

3. 编译扩展库, 分别执行下面的configure和make命令

# ./configure --with-php-config=/usr/local/php7/bin/php-config
# make -j12
# make -j12 install

4.配置php.ini

# vim /usr/local/php7/etc/php.ini

在php.ini文件中找到设置扩展目录的位置, 然后将扩展路径设置到apache2 modules目录下

extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/"
extension=exif.so

5.重启apache, 查看phpinfo信息, 即可看到刚才添加进去的exif扩展库.

安装Xdebug

Xdebug官网:https://xdebug.org

# wget https://xdebug.org/files/xdebug-2.6.0alpha1.tgz
# tar -zxvf xdebug-2.6.0alpha1.tgz
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php7/bin/php-config
# make -j12
# make -j12 install

配置Xdebug, 修改php.ini:
具体参数这里有说明 https://xdebug.org/docs/all_settings

[Xdebug]
extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart = 1
xdebug.remote_host=192.168.10.
xdebug.remote_port=9000
;xdebug.remote_connect_back = 1
;日志记录
;xdebug.profiler_enable=on
;xdebug.trace_output_dir="/root/xdebug/trace.log"
;xdebug.profiler_output_dir="/root/xdebug/profiler.log"

通过在请求里面带上 XDEBUG_SESSION 参数, 并且把参数值设置为之前XDebug里面配置的“idekey”的值, 就可以激活服务端的调试。

例如, 可以在POST或者GET参数里面加上 XDEBUG_SESSION=AceSheep, 服务端就会启动调试了。
比如我们要调试 http://www.abc.com/test.php, 那么访问链接http://www.abc.com/test.php?XDEBUG_SESSION=AceSheep 就可以启动调试了。


扫描二维码,在手机上阅读!

添加新评论