ubuntu环境下lnmp环境搭建(3)之Php

时间:2021-08-21 15:49:21
1.lnmp详细 
2. 到php目录

3.下载PHP安装包

4.tar解压 

tar -zxvf /home/sniper/Downloads/php-5.6.13.tar.gz

5. 编译看看

sudo groupadd www

sudo useradd -g www -s /sbin/nologin -M www

./configure  --prefix=/home/test/alidata/soft/php --with-config-file-path=/usr/local/php/etc --with-mysql=/home/test/alidata/soft/mysql  --enable-fpm --with-fpm-user=www  --with-fpm-group=www  --with-zlib  --enable-mbstring   --enable-xml   --enable-sockets --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --with-zlib --enable-zip --with-cur --enable-pcntl  --enable-shmop  --enable-sysvmsg  --enable-sysvsem  --enable-sysvshm  --with-mhash  --with-openss --enable-bcmath --with-libxml-dir

说明:

--prefix:安装目录

--with-config-file-path:配置文件路径

--with-mysql:对应mysql路径

--enable-fpm:fpm可用(后面两个是其启动用户)

6. 编译make

7. 安装make install

8. .进入php5.6.13文件夹

cd /home/test/alidata/soft/php

9. fpm

配置文件:/home/test/alidata/soft/php/etc

运行:/home/test/alidata/soft/php/sbin

sudo ./php-fpm

10. 配置nginx访问fpm

nginx的html下新建测试php--testfpm.php

进入/home/test/alidata/soft/nginx/conf

sudo vim nginx.conf

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;

}

curl localhost/testfpm.php

成功