您的位置:首页 > 运维架构 > Nginx

linux 安装PHP/nginx 环境

2018-01-04 12:21 190 查看
STEP 1:

依次编译安装依赖包 openssl pcre zlib三个包

然后安装curl 如果要开启ssl模式的话 需要在编译时加上 --with-openssl=/usr/local/openssl

STEP2:

安装php

./configure --prefix=/usr/local/php --enable-fpm

--with-curl=/usr/local/curl

--with-pcre-dir=/usr/local/pcre

--with-zlib-dir=/usr/local/zlib

--with-openssl-dir=/usr/local/openssl

--with-mysqli --enable-mbstring

STEP3:

安装nginx

./configure --prefix=/usr/local/nginx

--with-pcre=/usr/local/src/pcre-8.39

--with-zlib=/usr/local/src/zlib-1.2.11

--with-openssl=/usr/local/src/openssl-1.1.0e

STEP4:安装一系列扩展库

安装pdo扩展   (php7 需要 yum install autoconf)

1,进入php源码目录 cd /usr/local/src/php-5.6.27/ext/pdo_mysql

2,在当前文件夹下运行phpize命令 /usr/local/php/bin/phpize  回车

3,输入命令   ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql  

4,make && make install

安装openssl扩展 (php7 需要将/usr/local/src/php-5.6.27/ext/openssl下的config0.m4拷贝成config.m4)

1,进入php源码目录 cd /usr/local/src/php-5.6.27/ext/openssl

2,在当前文件夹下运行phpize命令 /usr/local/php/bin/phpize  回车

3,输入命令   ./configure --with-php-config=/usr/local/php/bin/php-config --with-openssl  

4,make && make install

安装gd扩展

yum install libpng(如果没有安装这个依赖包)

yum install libpng-devel(如果没有安装这个依赖包)

1,进入php源码目录 cd /usr/local/src/php-5.6.27/ext/gd

2,在当前文件夹下运行phpize命令 /usr/local/php/bin/phpize  回车

3,输入命令   ./configure --with-php-config=/usr/local/php/bin/php-config --with-gd  

4,make && make install

新建nginx用户并归到root组下:

adduser nginx

passwd nginx

 修改 /etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉

## Allows people in group wheel to run all commands

%wheel    ALL=(ALL)    ALL

然后修改用户,使其属于root组(wheel),命令如下:

#usermod -g root tommy

修改完毕,现在可以用tommy帐号登录,然后用命令 su - ,即可获得root权限进行操作
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: