Red Hat Enterprise Linux 7 高薪入门pdf下载
1、安装前准备:
yum -y install gcc automake autoconf libtool make gcc-c++ glibc \
libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel \
libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \
zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \
ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel \
krb5 krb5-devel libidn libidn-devel openssl openssl-devel
2、新版php-fpm编译安装(推荐安装方式)
wget http://cn2.php.net/distributions/php-5.6.10.tar.gz
tar zvxf php-5.6.10.tar.gz
cd php-5.6.10
./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt
--enable-mbstring --disable-pdo --with-curl --disable-debug --disable-rpath
--enable-inline-optimization --with-bz2 --with-zlib --enable-sockets
--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex
--with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli
--with-gd --with-jpeg-dir
make all install
3、对php-fpm运行用户进行设置
cd /usr/local/php
cp etc/php-fpm.conf.default etc/php-fpm.conf
4、编译安装nginx
tar zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_stub_status_module \
--with-http_spdy_module --with-http_gzip_static_module --with-http_flv_module \
--with-http_mp4_module --with-http_ssl_module --with-pcre=/root/pcre-8.37 \
--with-openssl=/root/openssl-1.0.1p --with-zlib=/root/zlib-1.2.8
make && make install
5、修改nginx配置文件
vi /usr/local/nginx/conf/nginx.conf
其中server段增加如下配置:
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
6、创建测试php文件
创建php文件
在/usr/local/nginx/html下创建index.php文件,输入如下内容
<?php
echo phpinfo();
?>
7、启动服务
启动php-fpm:
/usr/local/php/sbin/php-fpm
启动nginx:
/usr/local/nginx/sbin/nginx
8、浏览器访问
访问http://你的服务器ip/index.php,就可以见到php信息了。
转载请注明:谷谷点程序 » nginx+php编译安装