LNMP环境搭建(PHP)

1、安装依赖包

[root@linux application]# yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y

[root@linux application]# yum install freetype-devel libpng-devel gd-devel libcurl-devel livxslt-devel libxslt-devel -y

[root@linux php-5.3.27]# yum install libtool-ltdl-devel

[root@linux tools]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

[root@linux tools]# tar zxf libiconv-1.14.tar.gz

[root@linux tools]# cd libiconv-1.14

[root@linux tools]# ./configure --prefix=/usr/local/libiconv

[root@linux tools]# make

[root@linux tools]# make install

[root@linux tools]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

[root@linux tools]# yum -y install libmcrypt-devel

[root@linux tools]# yum -y install mhash

[root@linux tools]# yum -y install mcrypt

2、安装PHP

1)下载

https://www.php.net/distributions/php-5.3.27.tar.gz

2)解压配置

[root@linux tools]# tar zxf php-5.3.27.tar.gz

[root@linux tools]# cd php-5.3.27

[root@linux php-5.3.27]# ./configure \

--prefix=/application/php5.3.27 \

--with-mysql=/application/mysql \

--with-iconv-dir=/usr/local/libiconv \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir=/usr \

--enable-xml \

--disable-rpath \

--enable-safe-mode \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--with-curlwrappers \

--enable-mbregex \

--enable-fpm \

--enable-mbstring \

--with-mcrypt \

--with-gd \

--enable-gd-native-ttf \

--with-openssl \

--with-mhash \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-zip \

--enable-soap \

--enable-short-tags \

--enable-zend-multibyte \

--enable-static \

--with-xsl \

--with-fpm-user=nginx \

--with-fpm-group=nginx \

--enable-ftp

3)编译

[root@linux php-5.3.27]# ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/

[root@linux php-5.3.27]# touch ext/phar/phar.phar

[root@linux php-5.3.27]# make

4)安装

[root@linux php-5.3.27]# make install

5)配置php.ini文件

[root@linux php-5.3.27]# ln -s /application/php5.3.27 /application/php

[root@linux php-5.3.27]# cp php.ini-production /application/php/lib/php.ini

6)配置FastCGI的配置文件php-fpm.conf

[root@linux php-5.3.27]# cd /application/php/etc/

[root@linux etc]# cp php-fpm.conf.default php-fpm.conf

7)启动php服务

[root@linux etc]# /application/php/sbin/php-fpm

8)检查php服务启动情况

[root@linux etc]# ps -ef|grep php-fpm

9)访问

nginx.conf文件location节点配置如下:

        location / {

            root   html;

            index  index.html index.htm;

            fastcgi_pass  127.0.0.1:9000;

            fastcgi_index index.php;

            include fastcgi.conf;

        }

Web根目录下,新建test.php文件,用如下内容填充:

<?php

phpinfo();

?>

访问:http://192.168.220.129/test.php,出现php探针页面,如下图:

php安装完成!

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值