当前位置: 首页 > 工具软件 > PHPDBG > 使用案例 >

phpdbg使用之一(源码安装php7.3并安装phpdbg)

乐华晖
2023-12-01

介绍最新版PHP7.3的安装及调试工具phpdbg的编译

1.安装依赖环境

yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libzip

2. 下载并安装

2.1 源码下载

$ wget http://tw2.php.net/get/php-7.3.0.tar.gz/from/this/mirror

2.2 源码编译

php版本 >5.6 之后phpdbg已经集成在php的代码包中,编译参数添加 --enable-phpdbg 即可
5.6参考使用: https://github.com/krakjoe/phpdbg
安装参考:https://www.cnblogs.com/SofuBlue/p/8267020.html

$ tar -zxvf mirror

$ cd php-7.3.0

$ ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pear --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl --enable-phpdbg

【错误1】configure: error: Please reinstall the libzip distribution

$ wget https://nih.at/libzip/libzip-1.2.0.tar.gz
$ tar -zxvf  libzip-1.2.0
$ ./configure
$ make && make install

如果遇到更多错误,请参考:https://blog.csdn.net/cbuy888/article/details/82588813

【错误2】configure: error: Please reinstall readline - I cannot find readline.h

$ yum -y install readline-devel

参考:https://blog.csdn.net/u011608531/article/details/50756112

$ make && make install

【错误2】/usr/local/include/zip.h:320: 附注:需要类型‘int’,但实参的类型为‘char *’
/root/php-7.3.0/ext/zip/php_zip.c:2121: 错误:提供给函数‘zip_set_file_comment’的实参太多
/root/php-7.3.0/ext/zip/php_zip.c: 在函数‘c_ziparchive_setExternalAttributesName’中:
/root/php-7.3.0/ext/zip/php_zip.c:2154: 错误:提供给函数‘zip_name_locate’的实参太多
/root/php-7.3.0/ext/zip/php_zip.c:2154: 错误:赋值运算的左操作数必须是左值
/root/php-7.3.0/ext/zip/php_zip.c:2158: 错误:‘zip_flags_t’未声明(在此函数内第一次使用)
/root/php-7.3.0/ext/zip/php_zip.c:2158: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
/root/php-7.3.0/ext/zip/php_zip.c:2158: 错误:所在的函数内也只报告一次。)
/root/php-7.3.0/ext/zip/php_zip.c:2158: 错误:expected ‘)’ before ‘flags’
/root/php-7.3.0/ext/zip/php_zip.c:2159: 错误:提供给函数‘zip_file_set_external_attributes’的实参太多

使用:

$ cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h

参考博客: https://blog.csdn.net/oxiaobaio/article/details/80854226

解决完错误,接续

$ make clean
$ make & make install

2.3 设置软连接

$ ln -s /usr/local/php/bin/php /usr/local/bin/php
$ ln /usr/local/php/bin/phpdbg /usr/local/bin/phpdbg

2.4 查看PHPdbg

$ phpdbg -v

[Welcome to phpdbg, the interactive PHP debugger, v0.5.0]
To get help using phpdbg type “help” and press enter
[Please report bugs to http://bugs.php.net/report.php]

 类似资料: