centos7源码方式安装php和nginx

安装php

更新一些基础依赖

yum update
yum install -y epel-release gcc bison biz2 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 wget  openssl openssl--devel gcc-c++ pcre pcre-devel libzip libzip-devel libpng libpng-devel libmcrypt libmcrypt-devel libXpm-devel freetype-devel libjpeg-devel libvpx-devel libmcrypt unzip 

创建用户和用户组

groupadd www
useradd -g www -s /sbin/nologin www

新建软件安装文件夹

mkdir -p /usr/local/src/
cd /usr/local/src/

编译安装安装php

cd /usr/local/src/
wget https://linux-1251121573.cos.ap-guangzhou.myqcloud.com/soft/linux/php-5.6.39.tar.xz
tar vxf php-5.6.39.tar.xz
cd php-5.6.39
./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-mcrypt=/usr/include \
--with-sqlite3 \
--with-pdo-sqlite \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-posix \
--enable-pcntl \
--enable-shmop \
--enable-sysvshm \
--enable-sysvsem \
--enable-sysvmsg \
--enable-phar \
--enable-zip \
--with-zlib \
--with-zlib-dir \
--with-bz2 \
--with-gd \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-webp-dir \
--with-jpeg-dir \
--with-png-dir \
--with-xpm-dir \
--with-freetype-dir \
--enable-exif \
--enable-json \
--enable-libxml \
--with-libxml-dir \
--enable-xml \
--enable-xmlreader \
--enable-xmlwriter \
--enable-simplexml \
--with-pear \
--with-xsl \
--enable-dom \
--enable-soap \
--enable-wddx \
--with-xmlrpc \
--enable-ctype \
--enable-filter \
--with-pcre-regex \
--with-pcre-jit \
--with-enchant \
--with-pspell \
--enable-fileinfo \
--enable-mbstring \
--with-iconv \
--enable-hash \
--with-openssl \
--with-mcrypt \
--enable-bcmath \
--with-gmp \
--enable-session \
--enable-sockets \
--enable-ftp \
--with-curl \
--with-ldap \
--with-ldap-sasl \
--with-imap \
--with-kerberos \
--with-imap-ssl \
--enable-calendar \
--with-gettext \
--with-tidy \
--with-readline \
--enable-tokenizer \
--enable-opcache \
--enable-cli \
--enable-cgi \
--enable-fpm \
--enable-phpdbg

make && make install

安装nginx

cd /usr/local/src/
wget http://nginx.org/download/nginx-1.7.4.tar.gz
tar -zxvf nginx-1.7.4.tar.gz
cd  nginx-1.7.4
./configure
make 
make install 

创建nginx+php配置文件夹

mkdir -p /usr/local/php/etc/php-fpm.d
mkdir -p /usr/local/nginx/conf/servers

然后编辑 nginx和php的配置文件,使php和nginx能互通即可

你可能感兴趣的:(环境安装,linux)