solution:
1. Make sure the current extension supports php7
2. The error reported when compiling in the normal way is basically because the old version of php that comes with centos (mine is the reason) affects the .php extension and reads the files of the old version of php when compiling.
3. To solve the problem, follow Baidu search for "Completely uninstall PHP from Linux CentOS" https://www.cnblogs.com/sunshine-H/p/8117105.html and uninstall the old version of PHP to solve the problem.
=========You don’t need to read the following for normal compilation==========
php7.2 linux compilation and common errors
yum install epel-release -y
yum update
yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
--disable-debug 表示调试 应该是调试扩展用的一般不需要加上
./configure --prefix=/opt/php72 --exec-prefix=/opt/php72/ --bindir=/opt/php72/bin/ --sbindir=/opt/php72/sbin/ --includedir=/opt/php72/include/ --libdir=/opt/php72/lib/php/ --mandir=/opt/php72/php/man/ --with-config-file-path=/opt/php72/etc/ --with-mhash --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --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 --with-pear --with-gettext --enable-session --with-curl --with-openssl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fileinfo
4. Start compiling (if you switch the nts ts version, you need to run " make clean " and then rerun configure )
make && make install
5. Compile extension
6. Run phpize (multiple versions of php need to use the full path to run the corresponding version of phpize)
/opt/php72/bin/phpize
7. Run ./configure. Note that an error may be reported due to path problems. It is best to add --with-php-config.
./configure --with-php-config=/opt/php72/bin/php-config
8. Compile (if you switch to nts ts version, you need to run " make clean " and then rerun configure )
make && make install
The error I encountered