前置:libxml2, libxml2-devel, openssl-devel, curl-devel, libjpeg, libjpeg-devel, libpng, libpng-devel, freetype, freetype-devel, libxslt-devel
步骤:
1. 下载源码解压.
2. ./configure 参数(安装目录, 各种扩展开启参数, APACHE所需的PHP模块编译).
3.根据报错安装所需的开发包.
4. make && make install.
5. 创建php.ini, php-fpm.conf配置文件, 注意创建的位置.
6. php加入环境变量.
7. 找到php-fpm启动文件的位置, 启动php-fpm.
问题一:
./configure ...... --with-curl ...... 出现问题--
checking for cURL support... yes
checking for cURL in default path... not found
which: no dpkg-architecture in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wei/bin)
./configure: line 23538: curl-dir: No such file or directory
checking for cURL 7.10.5 or greater... ./configure: line 23553: curl-config: command not found
configure: error: cURL version 7.10.5 or later is required to compile php with cURL support
解决:
思路:缺失哪样装哪样.一般都是 软件包名-devel 结尾,指的是此软件包开发工具.
参考:http://blog.sina.com.cn/s/blog_75a07c3b0101kcwb.html
问题二:
用之前安装过一次的PHP源码重新安装PHP时,./configure这一步很顺利,到make 这一步时报错:
c:204: undefined reference to `executor_globals'
解决:
经过网上查找,在make之前需要先make clean, 原因可能是这源码曾经用过一次,留了一些上次安装的信息,与此次安装信息不符,make clean可能是清理这些信息的。
问题三:
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解决:
虽然提示的是像是版本问题,实际上还是因为缺少此开发工具,只要安装 libxslt-devel 即可解决。
配置
./configure --prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip \
--with-apxs2=/usr/local/apache2/bin/apxs