LNMP PHP软件安装
1.1 解决PHP软件的依赖关系
yum install zlib-devel libxml2-devel libjpeg-devellibjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devellibcurl-devel libxslt-devel libxslt-devel -y
1.1.1 libiconv软件安装
mkdir -p /home/oldboy/tools
cd /home/oldboy/tools
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv ###指定软件的安装目录
make
make install
说明: libiconv软件对文本进行编码间的转换,用它来处理中文各种编码之间的转换
注意:使用yum安装不上libiconv软件,就要使用下载,编译安装。
#wget -O /etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-6.repo
yum -y install libmcrypt-devel mhash mcrypt
rpm -qa libmcrypt-devel mhash mcrypt
注:安装libmcrypt 实现加密功能的库,安装mhash(哈稀函数库)
1.2 安装PHP
1.2.1 下载解压PHP
可先下载好放到Windows盘中,然后传到Linux上,再解压。
[[email protected] libiconv-1.14]# cd /home/oldboy/tools/
[[email protected] tools]# tar xf php-5.5.32.tar.gz
[[email protected] tools]# ls
libiconv-1.14
libiconv-1.14.tar.gz
mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
nginx-1.10.2
nginx-1.10.2.tar.gz
php-5.5.32
php-5.5.32.tar.gz
[[email protected] tools]#
1.2.2 配置PHP软件选项
cd php-5.5.32
./configure \
--prefix=/application/php-5.5.32 \
--with-mysql=/application/mysql/ \
--with-pdo-mysql=mysqlnd \
--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-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--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-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-ftp \
--enable-opcache=no
1.2.3 ##防错
ln -s/application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
[[email protected] php-5.5.32]# pwd
/home/oldboy/tools/php-5.5.32
[[email protected] php-5.5.32]# touch ext/phar/phar.phar ##一些编译的文件要放到这个文件中
1.2.4 编译安装
[[email protected] php-5.5.32]# pwd
/home/oldboy/tools/php-5.5.32 ###注意一定要在这个目录下面编译
[[email protected] php-5.5.32]# make
[[email protected] php-5.5.32]# make install
1.2.5 PHP软件程序创建软链接
[[email protected] php-5.5.32]# ln -s /application/php-5.5.32/ /application/php
1.2.6 配置php解析文件/配置php-fpm配置文件
[[email protected] php-5.5.32]# cd/home/oldboy/tools/php-5.5.32
[[email protected] php-5.5.32]# ll php.ini*
-rw-r--r-- 1 1001 1001 69236 Feb 2 2016php.ini-development
-rw-r--r-- 1 1001 1001 69266 Feb 2 2016php.ini-production
[[email protected] php-5.5.32]# cd /home/oldboy/tools/php-5.5.32
[[email protected] php-5.5.32]# cp php.ini-production /application/php/lib/php.ini
##/application/php/lib/php.ini 为主进程配置文件,默认没有,需要从安装目录中复制过来
[[email protected]]#cd /application/php/etc/
[[email protected]]#cp php-fpm.conf.default php-fpm.conf
##php-fpm.conf为从配置文件,是nginx与PHP交流的的fastcgi配置文件。
扩展:文件比较命令 diff zdiffvimdiff windows上的文件比较
1.2.7 启动PHP
[[email protected] etc]# /application/php/sbin/php-fpm
[[email protected] etc]# ps -ef |grep php
root 124014 1 0 11:46 ? 00:00:00 php-fpm: master process (/application/php-5.5.32/etc/php-fpm.conf)
www 124015 124014 0 11:46 ? 00:00:00 php-fpm: pool www
www 124016 124014 0 11:46 ? 00:00:00 php-fpm: pool www
root 124018 1664 0 11:47 pts/1 00:00:00 grep php
[[email protected]]# netstat -lnutp|grep php
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 124014/php-fpm
[[email protected] etc]#