PHP安装
1.yum安装一些依赖库
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel libcurl libcurl-devel libxslt-devel openssl openssl-devel
2.创建PHP工作进程的拥有者
groupadd php
useradd -g php php
3.编译安装
/configure \
--prefix=/usr/local/php-7.0.10 \
--with-config-file-path=/usr/local/php-7.0.10/etc \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-bcmath \
--with-curl \
--with-openssl \
--enable-mbstring \
--with-freetype-dir \
--enable-fpm \
--with-jpeg-dir \
--with-png-dir \
--enable-zip \
--enable-exif \
--with-imap-ssl \
--with-libdir=lib64 \
--with-gd \
--with-mcrypt \
--enable-sockets \
--disable-fileinfo \
--with-fpm-user=php \
--with-fpm-group=php
make && make install
4.启动并查看PHP
/usr/local/php-7.0.13/sbin/php-fpm
ps aux | grep php
5.整合PHP,Nginx
vim /usr/local/nginx-1.8.0/conf/nginx.conf
打开:
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
fastcgi模块参数修改:
>/usr/local/nginx-1.8.0/conf/fastcgi_params (清空文件)
vim /usr/local/nginx-1.8.0/conf/fastcgi_params
写入:
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
killall nginx;
/usr/local/nginx-1.10.2/sbin/nginx