PHP 7.1.15编译安装
环境:CentOs 7.5
软件:PHP 7.1.15
1.安装编译依赖环境
yum -y install libxml2 libxml2-devel openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel
2.下载PHP7.1.15源码包
#git下载源码包
git clone https://github.com/JohnsonCydia/php7.git
#解压并进入源码包
tar -zxvf /tmp/php7/php-7.1.5.tar.gz && cd /tmp/php-7.1.5/
3.configure配置(详细配置在文末)
./configure --prefix=/usr/local/php7 --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
4.编译安装
make && make install
5.更改默认配置文件
cp /tmp/php-7.1.5/php.ini-development /usr/local/php7/lib/php/php.ini
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
6.配置systemctl支持
cp /tmp/php-7.1.5/sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm && chmod 755 /etc/init.d/php7-fpm
7.启动PHP-FPM
systemctl start php-fpm
systemctl enable php-fpm
8.查看运行状态
systemctl status php-fpm
#########################
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-06-15 15:45:00 CST; 2h 18min ago
Main PID: 18649 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
CGroup: /system.slice/php-fpm.service
├─18649 php-fpm: master process (/etc/php-fpm.conf)
├─18650 php-fpm: pool www
├─18651 php-fpm: pool www
├─18652 php-fpm: pool www
├─18653 php-fpm: pool www
└─18654 php-fpm: pool www
附录:编译安装参数
来源:./configure --help(google机翻加人工校正,渣渣英语,见谅~)
--prefix = PREFIX在PREFIX中安装与体系结构无关的文件
--exec-prefix = EPREFIX在EPREFIX中安装依赖于体系结构的文件
--bindir = DIR用户可执行文件[EPREFIX / bin]
--sbindir = DIR系统管理员可执行文件[EPREFIX / sbin]
--libexecdir = DIR程序可执行文件[EPREFIX / libexec]
--sysconfdir = DIR只读单机数据[PREFIX / etc]
--sharedstatedir = DIR可修改的独立于架构的数据[PREFIX / com]
--localstatedir = DIR可修改的单机数据[PREFIX / var]
--runstatedir = DIR可修改的每个进程数据[LOCALSTATEDIR / run]
--libdir = DIR目标代码库[EPREFIX / lib]
--includedir = DIR C头文件[PREFIX / include]
--oldincludedir =非gcc的DIR C头文件[/ usr / include]
--datarootdir = DIR只读arch.-independent data root [PREFIX / share]
--dadadir = DIR只读架构无关数据[DATAROOTDIR]
--infodir = DIR信息文档[DATAROOTDIR / info]
--localedir = DIR语言环境相关数据[DATAROOTDIR / locale]
--mandir = DIR man文档[DATAROOTDIR / man]
--docdir = DIR文档根[DATAROOTDIR / doc / PACKAGE]
--htmldir = DIR html文档[DOCDIR]
--dvidir = DIR dvi文档[DOCDIR]
--pdfdir = DIR pdf文档[DOCDIR]
--psdir = DIR ps文档[DOCDIR]
--build = BUILD 配置在BUILD上构建
--host = HOST 交叉编译以构建在HOST上运行的程序[BUILD]
--target = TARGET 为TARGET构建编译器[HOST]
--disable-option-checking忽略无法识别的选项--enable / - with options
--disable-FEATURE不包括FEATURE(与--enable-FEATURE = no相同)
--enable-FEATURE [= ARG]包括FEATURE [ARG = yes]
--with-PACKAGE [= ARG]使用PACKAGE [ARG = yes]
--with-PACKAGE不使用PACKAGE(与--with-PACKAGE = no相同)
--with-libdir = NAME在... / NAME中查找库而不是... / lib
--disable-rpath禁用传递其他运行时库搜索路径
--enable-re2c-cgoto 启用-g标志以re2c使用计算的goto gcc扩展名
--disable-gcc-global-regs 是否启用GCC全局寄存器变量
--with-apxs2 = FILE 构建共享的Apache 2.0 Handler模块。 FILE是可选的Apache apxs工具apxs的路径名
--disable-cli禁用构建PHP的CLI版本
--enable-embed = TYPE EXPERIMENTAL:启用嵌入式SAPI库的构建,TYPE是“共享”或“静态”。 TYPE =共享
--enable-fpm启用fpm SAPI可执行文件的构建
--with-fpm-user = USER设置php-fpm的默认用户(默认nobody)
--with-fpm-group = GRP设置php-fpm的组以运行为。对于系统用户,这个通常应该设置为匹配fpm用户名(默认值:nobody)
--with-fpm-systemd激活systemd集成
--with-fpm-acl使用POSIX访问控制列表
--with-litespeed将PHP构建为litespeed模块
--enable-phpdbg构建phpdbg
--enable-phpdbg-webhelper构建phpdbg web SAPI支持
--enable-phpdbg-debug在调试模式下构建phpdbg
--disable-cgi禁用构建PHP的CGI版本
--enable-gcov启用GCOV代码覆盖(需要LTP) - 仅限开发人员!
--enable-debug使用调试符号编译
--with-layout = TYPE设置安装文件的布局方式。类型可以是PHP还是GNU [PHP]
--with-配置文件中路径= PATH设置查找php.ini的路径[PREFIX / lib]
--with-配置文件中扫描-DIR = PATH设置扫描配置文件的路径
--enable-sigchild启用PHP自己的SIGCHLD处理程序
--enable-libgcc启用显式链接libgcc
--disable-short-tags禁用短格式<?默认情况下启动标记
--enable-dmalloc启用dmalloc
--disable-ipv6禁用IPv6支持
--enable-dtrace启用DTrace支持
--enable-fd-setsize设置描述符集的大小
--disable-all默认禁用所有的扩展
--disable-libxml禁用LIBXML支持
--with-libxml-dir = DIR LIBXML:libxml2安装前缀
--with-openssl = DIR包含OpenSSL支持(需要OpenSSL> =1.0.1)
--with-kerberos = DIR OPENSSL:包括Kerberos支持
--with-system-ciphers OPENSSL:使用系统默认密码列表而不是硬编码值
--with-pcre-regex = DIR包含Perl兼容的正则表达式支持。DIR是PCRE安装前缀BUNDLED
--with-pcre-jit启用PCRE JIT功能
--without-sqlite3 = DIR不包括SQLite3支持。 DIR是前缀SQLite3安装目录。
--with-zlib = DIR包含ZLIB支持(需要zlib> = 1.0.9)
--with-zlib-dir = DIR 定义zlib安装目录的位置
--enable-bcmath启用bc样式精度数学函数
--with-bz2 = DIR包括BZip2支持
--enable-calendar启用日历转换支持
--disable-ctype禁用ctype函数
--with-curl = DIR包括cURL支持
--enable-dba使用捆绑模块构建DBA。构建共享DBA扩展名使用--enable-dba = shared
--with-qdbm = DIR DBA:QDBM支持
--with-gdbm = DIR DBA:GDBM支持
--with-ndbm = DIR DBA:NDBM支持
--with-db4 = DIR DBA:Oracle Berkeley DB 4.x或5.x支持
--with-db3 = DIR DBA:Oracle Berkeley DB 3.x支持
--with-db2 = DIR DBA:Oracle Berkeley DB 2.x支持
--with-db1 = DIR DBA:Oracle Berkeley DB 1.x支持/仿真
--with-dbm = DIR DBA:DBM支持
--with-tcadb = DIR DBA:Tokyo Cabinet抽象数据库支持
--without-cdb = DIR DBA:CDB支持(捆绑)
--disable-inifile DBA:INI支持(捆绑)
--disable-flatfile DBA:FlatFile支持(捆绑)
--disable-dom禁用DOM支持
--with-libxml-dir = DIR DOM:libxml2安装前缀
--with-enchant = DIR包括附魔支持。需要GNU Aspell 1.1.3或更高版本。
--enable-exif启用EXIF(图像元数据)支持
--disable-fileinfo禁用fileinfo支持
--disable-filter禁用输入过滤器支持
--with-pcre-dir FILTER:pcre install prefix
--enable-ftp启用FTP支持
--with-openssl-dir = DIR FTP:openssl安装前缀
--with-gd = DIR包括GD支持。 DIR是GD库的基础安装目录BUNDLED
--with-webp-dir = DIR GD:设置libwebp安装前缀的路径
--with-jpeg-dir = DIR GD:设置libjpeg安装前缀的路径
--with-png-dir = DIR GD:设置libpng安装前缀的路径
--with-zlib-dir = DIR GD:设置libz安装前缀的路径
--with-xpm-dir = DIR GD:设置libXpm安装前缀的路径
--with-freetype-dir = DIR GD:设置FreeType 2安装前缀的路径
--enable-gd-native-ttf GD:启用TrueType字符串函数
--enable-gd-jis-conv GD:启用JIS映射的日语字体支持
--with-gettext = DIR包括GNU gettext支持
--with-gmp = DIR包括GNU MP支持
--with-mhash = DIR包括mhash支持
--disable-hash禁用哈希支持
--without-iconv = DIR排除iconv支持
--with-imap = DIR包括IMAP支持。 DIR是c-client安装前缀
--with-kerberos = DIR IMAP:包括Kerberos支持。 DIR是Kerberos安装前缀
--with-imap-ssl = DIR IMAP:包括SSL支持。 DIR是OpenSSL安装前缀
--with-interbase = DIR包括Firebird支持。 DIR是Firebird的基础,安装目录/ opt / firebird
--enable-intl启用国际化支持
--with-icu-dir = DIR指定可以找到ICU库和标头的位置
--disable-json禁用JavaScript对象序列化支持
--with-ldap = DIR包括LDAP支持
--with-ldap-sasl = DIR LDAP:包括Cyrus SASL支持
--enable-mbstring启用多字节字符串支持
--disable-mbregex MBSTRING:禁用多字节正则表达式支持
--with-libmbfl = DIR MBSTRING:使用外部libmbfl。 DIR是libmbfl的基础安装目录BUNDLED
--with-onig = DIR MBSTRING:使用外部oniguruma。 DIR是oniguruma安装前缀。如果未设置DIR,将使用捆绑的oniguruma
--with-mcrypt = DIR包括mcrypt支持
--with-mysqli = FILE包括MySQLi支持。 FILE是路径到mysql_config。如果没有传递值或mysqlnd作为FILE,将使用MySQL本机驱动程序
--enable-嵌入的mysqli MYSQLi:启用嵌入式支持注意:不适用于MySQL本机驱动程序!
--with MySQL的-袜子= SOCKPATH MySQLi / PDO_MYSQL:MySQL unix套接字指针的位置。如果未指定,则搜索默认位置
--with-oci8 = DIR包括Oracle数据库OCI8支持。 DIR默认为$ ORACLE_HOME。
--with-odbcver = HEX强制支持传递的ODBC版本。预期十六进制数,默认值0x0350。
--with-adabas = DIR包括Adabas D支持/ usr / local
--with-sapdb = DIR包括SAP DB支持/ usr / local
--with-solid = DIR包括Solid支持/ usr / local / solid
--with-ibm-db2 = DIR包括IBM DB2支持/ home / db2inst1 / sqllib
--with-ODBCRouter = DIR包括ODBCRouter.com支持/ usr
--with-empress = DIR包括Empress支持\ $ EMPRESSPATH
--with-birdstep = DIR包括Birdstep支持/ usr / local / birdstep
--with-custom-odbc = DIR包括用户定义的ODBC支持。 DIR是ODBC安装基础
--with-iodbc = DIR包括iODBC支持/ usr / local
--with-esoob = DIR包括Easysoft OOB支持/ usr / local / easysoft / oob / client
--with-unixODBC = DIR包括unixODBC支持/ usr / local
--with-dbmaker = DIR包括DBMaker支持
--disable-opcache禁用Zend OPcache支持
--disable-opcache-file禁用基于文件的缓存
--enable-pcntl启用pcntl支持(仅限CLI / CGI)
--disable-pdo禁用PHP数据对象支持
--with-pdo-dblib = DIR PDO:DBLIB-DB支持。 DIR是FreeTDS主目录
--with-pdo-firebird = DIR PDO:Firebird支持。 DIR是Firebird的基础
--with-pdo-mysql = DIR PDO:MySQL支持。 DIR是MySQL的基本目录
--with-zlib-dir = DIR PDO_MySQL:设置libz安装前缀的路径
--with-pdo-oci = DIR PDO:Oracle OCI支持。 DIR默认为\ $ ORACLE_HOME。
--with-PDO-ODBC =的unixODBC
--with-pdo-pgsql = DIR PDO:PostgreSQL支持。 DIR是PostgreSQL的基础
--without-PDO-源码= DIR
--with-pgsql = DIR包括PostgreSQL支持。 DIR是PostgreSQL
--disable-phar禁用phar支持
--disable-posix禁用类似POSIX的功能
--with-pspell = DIR包括PSPELL支持。
--with-libedit = DIR包括libedit readline替换(仅限CLI / CGI)
--with-readline = DIR包括readline支持(仅限CLI / CGI)
--with-recode = DIR包括重新编码支持
--disable-session禁用会话支持
--with-mm = DIR SESSION:包括mm支持会话存储
--enable-shmop启用shmop支持
--disable-simplexml禁用SimpleXML支持
--with-libxml-dir = DIR SimpleXML:libxml2安装前缀
--with-snmp = DIR包括SNMP支持
--with-openssl-dir = DIR SNMP:openssl安装前缀
--enable-soap启用SOAP支持
--with-libxml-dir = DIR SOAP:libxml2安装前缀
--enable-sockets启用套接字支持
--enable-sysvmsg启用sysvmsg支持
--enable-sysvsem启用System V信号量支持
--enable-sysvshm启用System V共享内存支持
--with-tidy = DIR包括TIDY支持
--disable-tokenizer禁用tokenizer支持
--enable-wddx启用WDDX支持
--with-libxml-dir = DIR WDDX:libxml2安装前缀
--with-libexpat-dir = DIR WDDX:XMLRPC-EPI的libexpat目录(不建议使用)
--disable-xml禁用XML支持
--with-libxml-dir = DIR XML:libxml2安装前缀
--with-libexpat-dir = DIR XML:libexpat安装前缀(不建议使用)
--disable-xmlreader禁用XMLReader支持
--with-libxml-dir = DIR XMLReader:libxml2安装前缀
--with-xmlrpc = DIR包括XMLRPC-EPI支持
--with-libxml-dir = DIR XMLRPC-EPI:libxml2安装前缀
--with-libexpat-dir = DIR XMLRPC-EPI:XMLRPC-EPI的libexpat目录(不建议使用)
--with-iconv-dir = DIR XMLRPC-EPI:XMLRPC-EPI的iconv目录
--disable-xmlwriter禁用XMLWriter支持
--with-libxml-dir = DIR XMLWriter:libxml2安装前缀
--with-xsl = DIR包括XSL支持。 DIR是libxslt的基础
--enable-zip包含Zip读/写支持
--with-zlib-dir = DIR ZIP:设置libz安装前缀的路径
--with-pcre-dir ZIP:pcre install prefix
--with-libzip = DIR ZIP:使用libzip
--with-zlib-dir = DIR mysqlnd:设置libz安装前缀的路径
--enable-shared = PKGS构建共享库default = yes
--enable-static = PKGS构建静态库default = yes
--enable-fast-install= PKGS
--with-gnu-ld假设C编译器使用GNU ld default = no
--disable-libtool-lock避免锁定(可能会破坏并行构建)
--with-pic尝试仅使用PIC /非PIC对象默认=同时使用两者
--with-tags = TAGS自动包含其他配置