1、php安装的时有两种方式:
(1):php作为apapche的模块形式存在,需要用apxs指定apapche位置,并且用apxs来自动的加载模块;需要结合apapche使用(处理动态请求);
(2):php作为一个独立的服务单独运行,不需要指定其路径;
而两者的编译参数时不一样的;
php作为模块的形式的编译参数如下:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
错误信息:
configure: error: xml2-config not found. Please check your libxml2 installation.
yum install -y libxml2-devel
configure: error: Cannot find OpenSSL's
yum install -y openssl openssl-devel
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
yum install -y bzip2 bzip2d-devel
configure: error: jpeglib.h not found.
yum install -y libjpeg-devel
configure: error: png.h not found.
yum install -y libpng libpng-devel
configure: error: freetype-config not found.
yum install -y freetype freetype-devel
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
yum install -y epel-release
yum install -y libmcrypt-devel
汇总后如下:基本全了;
yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2d-devel libjpeg-devel libpng libpng-devel freetype freetype-devel epel-release libmcrypt-devel
3、php作为服务单独运行的编译参数如下:
./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl
报错信息如下:
configure: error: in `/usr/local/src/php-5.6.30':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
安装: yum install -y gcc
checking libxml2 install dir... yes
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
安装: yum install -y libxml2-devel
configure: error: Cannot find OpenSSL's
安装: yum install -y openssl openssl-devel
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
安装: yum install -y libcurl-devel
configure: error: jpeglib.h not found.
安装:yum install -y libjpeg-devel
configure: error: png.h not found.
安装:yum install -y libpng libpng-devel
configure: error: freetype-config not found.
安装:yum install -y freetype freetype-devel
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
安装:yum install -y epel-relese
yum install -y libmcrypt-devel
汇总后如下: yum install -y gcc libxml2-devel openssl openssl-devel libcurl-devel libjpeg-devel libpng libpng-devel freetype freetype-devel epel-relese libmcrypt-devel
如上;