当前位置:首页 > 前端 > 正文

CentOS 7.4 php、ngnix环境搭建

cd /usr/local/src

wgethttp://cn2.php.net/distributions/php-5.6.39.tar.gz tar -xvzf php-5.6.39.tar.gz cd php-5.6.39
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-curl --with-zlib --with-openssl
make make install   复制配置文件及执行文件 ln -s/usr/local/php/bin/php /usr/bin/php cp/usr/local/src/php-5.6.39/php.ini-production /usr/local/php/etc/php.ini ln -s/usr/local/php/etc/php.ini /etc/php.ini cp/usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp/usr/local/src/php-5.6.39/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 增加可执行权限 chmod +x/etc/init.d/php-fpm 修改配置文件php.ini vi /etc/php.ini date.timezone = PRC session.save_path="/var/lib/php/session"  记得要手动创建下这个目录 mkdir -p/var/lib/php/session   service php-fpm start   cd /usr/local/nginx/html/ unzip v.zip yum install unzip service php-fpm restart   cd /usr/local/src/ wgethttp://nginx.org/download/nginx-1.14.2.tar.gz yum install -y gcc gcc-c++  pcre pcre-devel  zlib zlib-devel openssl openssl-devel tar -xvzf nginx-1.14.2.tar.gz cd nginx-1.14.2  ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --pid-path=/usr/local/nginx/conf/nginx.pid --with-pcre
make && make install cd /usr/local/nginx/conf/ cp nginx.conf nginx.conf.default vi nginx.conf ../sbin/nginx -t ../sbin/nginx -s start ../sbin/nginx sbin/nginx -s reload   cd /usr/local/src/php-5.6.39  ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-curl --with-zlib --with-openssl --with-png-dir --with-gd yum -y install gd gd2 gd-devel gd2-devel zlib freetype  ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-curl --with-zlib --with-openssl --with-png-dir --with-gd make && make install   cd /usr/local/nginx/html/ vi conf/nginx.conf   cd /usr/local/src/ yum install gcc libxml2-devel openssl-devel curl-devel -y yum install php-gd service php-fpm restart cd php-5.6.39 vi /etc/php.ini ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-curl --with-zlib --with-openssl --with-gd cd /usr/local/src/php-5.6.39/ext/gd ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-curl --with-zlib --with-openssl --with-png-dir --with-gd /usr/local/php/bin/phpize service php-fpm stop cd /usr/local/nginx/html service php-fpm start cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ yum -y install gd gd2 gd-devel gd2-devel  wgetftp://ftp.sunfreeware.com/pub/freeware/SOURCES/gd-2.0.33.tar.gz cd /usr/local/src/ wgethttp://www.ijg.org/files/jpegsrc.v9b.tar.gz tar -xvzf jpegsrc.v9b.tar.gz ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static cd jpeg-9b/ ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static make && make install cd /usr/local/src/php-5.6.39/ext/gd/ /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config -with-png-dir --with-freetype-dir --with-jpeg-dir=/usr/local/jpeg -with-zlib-dir --with-gd cd /usr/local/src/php-5.6.39/ext/gd/ phpize /usr/local/php/bin/phpize yum install m4 yum install autoconf /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config -with-png-dir --with-freetype-dir --with-jpeg-dir=/usr/local/jpeg -with-zlib-dir --with-gd cd   /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ cd /usr/local/src/php-5.6.39/ext/gd make && make install  cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ service php-fpm restart