做hash -r
清除缓存,然后执行cmake --version
将阿里云的服务器重置了,尝试使用编译安装PHP
1.先更新yum,安装依赖
yum install epel-release -y
yum update
2.安装PHP的依赖,nginx的依赖(直接去网上搜的 )
yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
3.下载解压PHP源码包
wgt http://am1.php.net/distributions/php-7.2.10.tar.gz
tar -zxvf php-7.2.10
4.编译安装
cd php-7.2.10
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-mysqlnd-compression-support \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--enable-intl \
--with-mcrypt \
--with-libmbfl \
--enable-ftp \
--with-gd \
--enable-gd-jis-conv \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--disable-fileinfo \
--enable-opcache \
--with-pear \
--enable-maintainer-zts \
--with-ldap=shared \
--without-gdbm \
make && make install
安装完成后, PHP的文件应该是在
/user/local/php/
这个文件夹下
- 编译安装的额外参数:
开发环境:
--enable-phpdbg\
--enable-dtrace\
生产环境:
--disable-phpdbg\
--disable-dtrace\
5.PHP配置文件
- 在php-7.2.10文件夹中有两个默认的php.ini文件
php.ini-development //测试开发环境
php.ini-production //生产环境
//自己选一个复制到PHP的etc目录下
cp php.ini-production /usr/local/php/etc/php.ini
- 在php的etc文件夹下有个php-fpm.conf.default
//复制并改名
cd /user/local/php/etc
cp php-fpm.conf.default php-fpm.conf
- 在usr/local/php/etc/php-fpm.d目录下有个www.conf.default
cd usr/local/php/etc/php-fpm.d
cp www.conf.default www.conf
- 管理配置php-fpm
cd /php-7.2.10
cp ./sapi/fpm/php-fpm.service 到 /usr/lib/systemd/system/下
- 配置开机启动php-fpm
http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz