centos 安装php

centos 安装php

编译前的准备:

yum install -y gcc gcc-c++

yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel

解决安装时的错误:

configure: error: xml2-config not found. Please check your libxml2 installation. 

yum install libxml2 

 yum install libxml2-devel -y 

 ls /usr/bin/xml2-config

/usr/bin/xml2-config                        

configure: error: Please reinstall the libcurl distribution -

    easy.h should be in <curl-dir>/include/curl/   

 yum install curl-devel

configure: error: png.h not found

yum install libpng libpng-devel 

configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.  

 yum install icu 

 yum install libicu 

yum install libicu-devel

error: Cannot find ldap.h  

cp -frp /usr/lib64/libldap* /usr/lib/

 yum install php56-php-ldap

 yum install --skip-broken  php56-php-ldap

下载php 源码:

http://www.php.net/downloads.php

安装命令:

./configure --prefix=/usr/bin/php\

 --with-libdir=lib64\

 --enable-fpm\

 --with-fpm-user=php-fpm\

 --with-fpm-group=www\

 --enable-mysqlnd\

 --with-mysql=mysqlnd\

 --with-mysqli=mysqlnd\

 --with-pdo-mysql=mysqlnd\

 --enable-opcache\

 --enable-pcntl\

 --enable-mbstring\

 --enable-soap\

 --enable-zip\

 --enable-calendar\

 --enable-bcmath\

 --enable-exif\

 --enable-ftp\

 --enable-intl\

 --with-openssl\

 --with-zlib\

 --with-curl\

 --with-gd\

 --with-zlib-dir=/usr/lib\

 --with-png-dir=/usr/lib\

 --with-jpeg-dir=/usr/lib\

 --with-gettext\

 --with-mhash\

 --with-ldap=/usr/lib64

make && make install

参考:https://blog.kuoruan.com/101.html

猜你喜欢

转载自hw1287789687.iteye.com/blog/2328185