今天安装PHP的时候提示这个错误 configure: error: png.h not found.,这个是选择安装GD模块才会出现的错误,详细错误信息如下:

If configure fails try --with-vpx-dir=


If configure fails try --with-jpeg-dir=
configure: error: png.h not found.


经查资料说是libpng,devel包没安装,

执行下面两条命令即可解决

yum install libpng

yum install libpng-devel

然后重新编译安装就行了    


安装php扩展步骤

1.找到源码目录   ext;

2.源码目录 scripts/phpize, 生成conffigure文件  /home/huoweijie/package/php-7.1.0/scripts/phpize

这个时候会报没有权限的错误  Permission denied  别着急  这是没有可执行的权限 修改一下权限就好了  chmod +x /home/huoweijie/package/php-7.1.0/scripts/phpize

3.用./configure --with-php-config=/usr/local/php/bin/php-config

4.make && make install

5.修改php.ini     vim /usr/local/php/etc/php.ini in

6.重启php-fpm就ok了  可以用killall php-fpm  杀死php-fpm进程  然后重启 /usr/local/php/bin/php-fpm

第二步的时候有的同志可能会出现这个报错:

Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
Cannot find autoconf. Please check your autoconf installation and the  $PHP_AUTOCONF  environment variable is set correctly and then rerun this script.