1:下载PHP wget http://cn2.php.net/get/php-7.2.12.tar.xz/from/this/mirror
2:下载依赖包
yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel jemalloc jemalloc-devel
yum -y install libmcrypt-devel libxml2-devel bzip2 bzip2-devel curl curl-devel libjpeg-devel libpng-devel freetype-devel openldap openldap-devel
3:编译安装
/configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline --with-zlib --with-freetype-dir --with-gd --with-jpeg-dir --with-png-dir
4:问题
(1) Don't know how to define struct flock on this system, set --enable-opcache=no
编辑 /etc/ld.so.conf 加入/usr/local/lib
vim /etc/ld.so.conf.d/local.conf
/usr/local/lib 写入这个文件中
再执行 ldconfig即可
ldconfig -v
5:增加扩展 例如增加ssh扩展
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-ssh2=/usr/local/libssh2
make && make install
vim /usr/local/php/lib/php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ssh2.so