Blogger Information
Blog 39
fans 1
comment 0
visits 62352
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
安装php
Dai的博客
Original
1007 people have browsed it

1、安装依赖包

yum -y install gcc gcc-c++ autoconf 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 openldap openldap-devel nss_ldap openldap-clients openldap-servers

2、

yum install libxslt-devel* -y

3、安装 yum 无法安装 的 libiconv库

  先下载 libiconv库 下载 完成后解压

tar xf libiconv-1.15.tar.gz
cd libiconv-1.15
./configure --prefix=/usr/local/libiconv
make
make install

4、安装 libmcrypt-devel

yum -y install libmcrypt-devel

如果yum包里面没有安装源就事先配置epel第三方yum源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

5、安装mhash加密扩展库与mcrypt库

yum -y install mhash
yum -y install mcrypt

6、安装php

tar xf php-5.5.tar.gz
cd php.5.5

7、

sudo ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib64/
sudo ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

8、配置php

./configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/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-rpm-group-nginx \
--enable-ftp
//出现thank you for using php就是配置成功
============================================================
上面的为php5.5以下的版本
下面的为php5.5以上的版本
./configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/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-mbstring \
--enable-fpm \
--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=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no

9、

touch ext/phar/phar.phar
make 
//出现Bulid complete
//Don't forget to run 'make test'
//就是编译成功

10、安装

make install

11、拷贝PHP 配置文件到PHP默认目录

cp php.ini-production /usr/local/php/lib/php.ini
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf

11.1  修改php.ini 将PHP版本隐藏

expose_php = Off;

12、启动php-rpm

/usr/local/php/sbin/php-fpm

13、检查PHP服务的进程

ps -ef|grep php-rpm


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post