Linxu安装 PHP:
yum -y install libxml2 libxml2-devel 下载安装libxml2,通过libxml2编译安装PHP
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/ --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap=/usr --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear
make && make install
编译的时候出现很多error,如下:
编译error:
1、configure: error: Cannot find OpenSSL's <evp.h>
办法:
yum install openssl.x86_64 openssl-devel.x86_64 -y
2、configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
办法:
yum install libcurl.x86_64 libcurl-devel.x86_64 -y
3、If configure fails try --with-vpx-dir=<DIR> configure: error: jpeglib.h not found.
办法:
yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y
在yum这些包的时候,再次执行./configure的时候,再次出错。
然后,又yum一遍,提示出No package libjpeg-devel.x86_64,在yum库中没有找到这个包。
可以利用yum -y update命令更新yum库,更新完成以后,可以再次yum install,如果这一步成功,皆大欢喜。
如果依旧不可以,使用下一种方法,利用yum search 包名(例libjpeg-devel.x86_64可以写成libjpeg),可以搜出一些,可以找到相应其他的包
4、configure: error: Cannot find ldap.h
办法:
yum install php-ldap.x86_64 -y
yum install openldap-devel.x86_64 -y
5、configure: error: Don’t know how to define struct flock on this system, set –enable-opcache=no
解决方案:
vim /etc/ld.so.conf.d/local.conf (local.conf可以随便起名称,以.conf为后缀就可)
添加
/usr/local/lib
:wq 保存
ldconfig -v 生效
6、error: Cannot find ldap libraries in /usr/lib 这个可能是由于libldap32和libldap64冲突:
解决方法:cp -frp /usr/lib64/libldap* /usr/lib/