PHP5.3版本安装

第1章 PHP安装

1.1 安装准备

1.1.1 检查Nginx的安装情况

[[email protected] ~]# ll/application/nginx

lrwxrwxrwx. 1 root root 25Apr  4 10:22 /application/nginx ->/application/nginx-1.8.1/

[[email protected] ~]# lsof -i :80

COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

nginx   1635 root   10u IPv4  11106      0t0 TCP *:http (LISTEN)

nginx   1639 nginx  10u  IPv4  11106     0t0  TCP *:http (LISTEN)

[[email protected] ~]#

1.1.2 检查安装PHP所需的lib库

[[email protected] ~]# rpm -qazlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel

zlib-devel-1.2.3-29.el6.x86_64

[[email protected] ~]# rpm -qafreetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel

[[email protected] ~]# yum install-y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel

Loaded plugins:fastestmirror, security

Setting up Install Process

Loading mirror speeds fromcached hostfile

* base: mirrors.opencas.cn

* extras: mirrors.opencas.cn

* updates: mirrors.opencas.cn

base                                                                                                                        | 3.7kB     00:00

extras                                                                                                                      | 3.4 kB     00:00

updates                                                                                                                     |3.4 kB     00:00

updates/primary_db                                                                                                          | 4.6 MB     00:00

Package zlib-devel-1.2.3-29.el6.x86_64already installed and latest version

No package libiconv-develavailable.

Resolving Dependencies

--> Running transactioncheck

---> Packagelibjpeg-turbo-devel.x86_64 0:1.2.1-3.el6_5 will be installed

---> Package libxml2-devel.x86_640:2.7.6-20.el6_7.1 will be installed

--> Processing Dependency:libxml2 = 2.7.6-20.el6_7.1 for package: libxml2-devel-2.7.6-20.el6_7.1.x86_64

--> Running transactioncheck

---> Packagelibxml2.x86_64 0:2.7.6-20.el6 will be updated

--> Processing Dependency:libxml2 = 2.7.6-20.el6 for package: libxml2-python-2.7.6-20.el6.x86_64

---> Packagelibxml2.x86_64 0:2.7.6-20.el6_7.1 will be an update

--> Running transactioncheck

---> Packagelibxml2-python.x86_64 0:2.7.6-20.el6 will be updated

---> Packagelibxml2-python.x86_64 0:2.7.6-20.el6_7.1 will be an update

--> Finished DependencyResolution

Dependencies Resolved

====================================================================================================================================================

Package                                   Arch                         Version                                Repository                    Size

====================================================================================================================================================

Installing:

libjpeg-turbo-devel                       x86_64                       1.2.1-3.el6_5                           base                           96 k

libxml2-devel                             x86_64                       2.7.6-20.el6_7.1                        updates                       1.1 M

Updating for dependencies:

libxml2                                   x86_64                       2.7.6-20.el6_7.1                        updates                       803 k

libxml2-python                            x86_64                       2.7.6-20.el6_7.1                        updates                       323 k

Transaction Summary

====================================================================================================================================================

Install       2 Package(s)

Upgrade       2 Package(s)

Total download size: 2.3 M

Downloading Packages:

(1/4):libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64.rpm                                                                         |  96 kB     00:00

(2/4):libxml2-2.7.6-20.el6_7.1.x86_64.rpm                                                                                  | 803 kB     00:02

(3/4):libxml2-devel-2.7.6-20.el6_7.1.x86_64.rpm                                                                            | 1.1 MB     00:00

(4/4):libxml2-python-2.7.6-20.el6_7.1.x86_64.rpm                                                                            |323 kB     00:00

----------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                               646kB/s | 2.3 MB     00:03

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Updating  : libxml2-2.7.6-20.el6_7.1.x86_64                                                                                                 1/6

Installing :libxml2-devel-2.7.6-20.el6_7.1.x86_64                                                                                           2/6

Updating  : libxml2-python-2.7.6-20.el6_7.1.x86_64                                                                                          3/6

Installing :libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64                                                                                         4/6

Cleanup   : libxml2-python-2.7.6-20.el6.x86_64                                                                                              5/6

Cleanup   : libxml2-2.7.6-20.el6.x86_64                                                                                                      6/6

Verifying : libxml2-devel-2.7.6-20.el6_7.1.x86_64                                                                                           1/6

Verifying : libxml2-python-2.7.6-20.el6_7.1.x86_64                                                                                          2/6

Verifying : libxml2-2.7.6-20.el6_7.1.x86_64                                                                                                 3/6

Verifying : libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64                                                                                        4/6

Verifying : libxml2-2.7.6-20.el6.x86_64                                                                                                     5/6

Verifying : libxml2-python-2.7.6-20.el6.x86_64                                                                                              6/6

Installed:

libjpeg-turbo-devel.x86_640:1.2.1-3.el6_5                                libxml2-devel.x86_64 0:2.7.6-20.el6_7.1

Dependency Updated:

libxml2.x86_64 0:2.7.6-20.el6_7.1                                    libxml2-python.x86_64 0:2.7.6-20.el6_7.1

Complete!

[[email protected] ~]# yum install-y freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel

Loaded plugins:fastestmirror, security

Setting up Install Process

Loading mirror speeds fromcached hostfile

* base: mirrors.btte.net

* extras: mirrors.opencas.cn

* updates: mirrors.opencas.cn

Resolving Dependencies

--> Running transactioncheck

---> Packagefreetype-devel.x86_64 0:2.3.11-15.el6_6.1 will be installed

---> Packagegd-devel.x86_64 0:2.0.35-11.el6 will be installed

--> Processing Dependency:gd = 2.0.35-11.el6 for package: gd-devel-2.0.35-11.el6.x86_64

--> Processing Dependency:libXpm-devel for package: gd-devel-2.0.35-11.el6.x86_64

--> Processing Dependency:libX11-devel for package: gd-devel-2.0.35-11.el6.x86_64

--> Processing Dependency:fontconfig-devel for package: gd-devel-2.0.35-11.el6.x86_64

--> Processing Dependency:libgd.so.2()(64bit) for package: gd-devel-2.0.35-11.el6.x86_64

---> Packagelibcurl-devel.x86_64 0:7.19.7-46.el6 will be installed

--> Processing Dependency:libidn-devel for package: libcurl-devel-7.19.7-46.el6.x86_64

---> Packagelibpng-devel.x86_64 2:1.2.49-2.el6_7 will be installed

--> Processing Dependency:libpng = 2:1.2.49-2.el6_7 for package: 2:libpng-devel-1.2.49-2.el6_7.x86_64

---> Packagelibxslt-devel.x86_64 0:1.1.26-2.el6_3.1 will be installed

--> Processing Dependency:libxslt = 1.1.26-2.el6_3.1 for package: libxslt-devel-1.1.26-2.el6_3.1.x86_64

--> Processing Dependency:libgcrypt-devel for package: libxslt-devel-1.1.26-2.el6_3.1.x86_64

--> Processing Dependency:libxslt.so.1()(64bit) for package: libxslt-devel-1.1.26-2.el6_3.1.x86_64

--> Processing Dependency:libexslt.so.0()(64bit) for package: libxslt-devel-1.1.26-2.el6_3.1.x86_64

--> Running transactioncheck

---> Packagefontconfig-devel.x86_64 0:2.8.0-5.el6 will be installed

---> Package gd.x86_640:2.0.35-11.el6 will be installed

--> Processing Dependency:libXpm.so.4()(64bit) for package: gd-2.0.35-11.el6.x86_64

---> PackagelibX11-devel.x86_64 0:1.6.0-6.el6 will be installed

--> Processing Dependency:pkgconfig(xcb) >= 1.1.92 for package: libX11-devel-1.6.0-6.el6.x86_64

--> Processing Dependency:pkgconfig(xproto) for package: libX11-devel-1.6.0-6.el6.x86_64

--> Processing Dependency:pkgconfig(xcb) for package: libX11-devel-1.6.0-6.el6.x86_64

--> Processing Dependency:pkgconfig(kbproto) for package: libX11-devel-1.6.0-6.el6.x86_64

---> PackagelibXpm-devel.x86_64 0:3.5.10-2.el6 will be installed

--> Processing Dependency:libXt.so.6()(64bit) for package: libXpm-devel-3.5.10-2.el6.x86_64

---> Packagelibgcrypt-devel.x86_64 0:1.4.5-11.el6_4 will be installed

--> Processing Dependency:libgpg-error-devel for package: libgcrypt-devel-1.4.5-11.el6_4.x86_64

---> Packagelibidn-devel.x86_64 0:1.18-2.el6 will be installed

---> Package libpng.x86_642:1.2.49-1.el6_2 will be updated

---> Package libpng.x86_642:1.2.49-2.el6_7 will be an update

---> Packagelibxslt.x86_64 0:1.1.26-2.el6_3.1 will be installed

--> Running transactioncheck

---> Package libXpm.x86_640:3.5.10-2.el6 will be installed

---> Package libXt.x86_640:1.1.4-6.1.el6 will be installed

---> Packagelibgpg-error-devel.x86_64 0:1.7-4.el6 will be installed

---> Package libxcb-devel.x86_640:1.9.1-3.el6 will be installed

--> Processing Dependency:pkgconfig(xau) >= 0.99.2 for package: libxcb-devel-1.9.1-3.el6.x86_64

---> Packagexorg-x11-proto-devel.noarch 0:7.7-9.el6 will be installed

--> Running transactioncheck

---> PackagelibXau-devel.x86_64 0:1.0.6-4.el6 will be installed

--> Finished DependencyResolution

Dependencies Resolved

====================================================================================================================================================

Package                                   Arch                        Version                                  Repository                    Size

====================================================================================================================================================

Installing:

freetype-devel                            x86_64                      2.3.11-15.el6_6.1                         base                         365 k

gd-devel                                  x86_64                      2.0.35-11.el6                             base                          78 k

libcurl-devel                             x86_64                      7.19.7-46.el6                             base                         246 k

libpng-devel                              x86_64                      2:1.2.49-2.el6_7                          updates                      112 k

libxslt-devel                             x86_64                      1.1.26-2.el6_3.1                          base                         561 k

Installing for dependencies:

fontconfig-devel                          x86_64                      2.8.0-5.el6                               base                         209 k

gd                                        x86_64                      2.0.35-11.el6                             base                         142 k

libX11-devel                              x86_64                      1.6.0-6.el6                               base                         983 k

libXau-devel                              x86_64                      1.0.6-4.el6                               base                          14 k

libXpm                                    x86_64                      3.5.10-2.el6                              base                          51 k

libXpm-devel                              x86_64                      3.5.10-2.el6                              base                          33 k

libXt                                    x86_64                     1.1.4-6.1.el6                            base                         165 k

libgcrypt-devel                           x86_64                      1.4.5-11.el6_4                            base                         118 k

libgpg-error-devel                        x86_64                      1.7-4.el6                                 base                          14 k

libidn-devel                              x86_64                      1.18-2.el6                                base                         137 k

libxcb-devel                              x86_64                      1.9.1-3.el6                               base                         1.0 M

libxslt                                   x86_64                      1.1.26-2.el6_3.1                          base                         452 k

xorg-x11-proto-devel                      noarch                      7.7-9.el6                                 base                         286 k

Updating for dependencies:

libpng                                    x86_64                      2:1.2.49-2.el6_7                          updates                      182 k

Transaction Summary

====================================================================================================================================================

Install      18 Package(s)

Upgrade       1 Package(s)

Total download size: 5.0 M

Downloading Packages:

(1/19):fontconfig-devel-2.8.0-5.el6.x86_64.rpm                                                                             |209 kB     00:00

(2/19):freetype-devel-2.3.11-15.el6_6.1.x86_64.rpm                                                                         | 365 kB     00:00

(3/19): gd-2.0.35-11.el6.x86_64.rpm                                                                                         | 142 kB     00:00

(4/19):gd-devel-2.0.35-11.el6.x86_64.rpm                                                                                   |  78 kB    00:00

(5/19):libX11-devel-1.6.0-6.el6.x86_64.rpm                                                                                 | 983 kB     00:00

(6/19):libXau-devel-1.0.6-4.el6.x86_64.rpm                                                                                  |  14 kB    00:00

(7/19):libXpm-3.5.10-2.el6.x86_64.rpm                                                                                      |  51 kB     00:00

(8/19):libXpm-devel-3.5.10-2.el6.x86_64.rpm                                                                                |  33 kB     00:00

(9/19):libXt-1.1.4-6.1.el6.x86_64.rpm                                                                                      | 165 kB     00:00

(10/19):libcurl-devel-7.19.7-46.el6.x86_64.rpm                                                                             | 246 kB     00:00

(11/19):libgcrypt-devel-1.4.5-11.el6_4.x86_64.rpm                                                                          | 118 kB     00:00

(12/19):libgpg-error-devel-1.7-4.el6.x86_64.rpm                                                                            |  14 kB    00:00

(13/19):libidn-devel-1.18-2.el6.x86_64.rpm                                                                                 | 137 kB     00:00

(14/19):libpng-1.2.49-2.el6_7.x86_64.rpm                                                                                    |182 kB     00:00

(15/19):libpng-devel-1.2.49-2.el6_7.x86_64.rpm                                                                             | 112 kB     00:00

(16/19): libxcb-devel-1.9.1-3.el6.x86_64.rpm                                                                                | 1.0 MB     00:00

(17/19):libxslt-1.1.26-2.el6_3.1.x86_64.rpm                                                                                | 452 kB     00:00

(18/19):libxslt-devel-1.1.26-2.el6_3.1.x86_64.rpm                                                                          | 561 kB     00:00

(19/19):xorg-x11-proto-devel-7.7-9.el6.noarch.rpm                                                                           | 286kB     00:00

----------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                               2.6MB/s | 5.0 MB     00:01

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Updating  : 2:libpng-1.2.49-2.el6_7.x86_64                                                                                                  1/20

Installing : libXpm-3.5.10-2.el6.x86_64                                                                                                     2/20

Installing : xorg-x11-proto-devel-7.7-9.el6.noarch                                                                                          3/20

Installing :freetype-devel-2.3.11-15.el6_6.1.x86_64                                                                                        4/20

Installing :fontconfig-devel-2.8.0-5.el6.x86_64                                                                                            5/20

Installing :libXau-devel-1.0.6-4.el6.x86_64                                                                                                 6/20

Installing :libxcb-devel-1.9.1-3.el6.x86_64                                                                                                7/20

Installing : libX11-devel-1.6.0-6.el6.x86_64                                                                                                8/20

Installing : gd-2.0.35-11.el6.x86_64                                                                                                        9/20

Installing :2:libpng-devel-1.2.49-2.el6_7.x86_64                                                                                          10/20

Installing :libgpg-error-devel-1.7-4.el6.x86_64                                                                                           11/20

Installing :libgcrypt-devel-1.4.5-11.el6_4.x86_64                                                                                         12/20

Installing : libXt-1.1.4-6.1.el6.x86_64                                                                                                    13/20

Installing :libXpm-devel-3.5.10-2.el6.x86_64                                                                                              14/20

Installing :libxslt-1.1.26-2.el6_3.1.x86_64                                                                                               15/20

Installing :libidn-devel-1.18-2.el6.x86_64                                                                                                 16/20

Installing :libcurl-devel-7.19.7-46.el6.x86_64                                                                                            17/20

Installing : libxslt-devel-1.1.26-2.el6_3.1.x86_64                                                                                         18/20

Installing :gd-devel-2.0.35-11.el6.x86_64                                                                                                 19/20

Cleanup   : 2:libpng-1.2.49-1.el6_2.x86_64                                                                                                20/20

Verifying : libgcrypt-devel-1.4.5-11.el6_4.x86_64                                                                                           1/20

Verifying : libidn-devel-1.18-2.el6.x86_64                                                                                                 2/20

Verifying : libxcb-devel-1.9.1-3.el6.x86_64                                                                                                3/20

Verifying : libXpm-devel-3.5.10-2.el6.x86_64                                                                                               4/20

Verifying : libXau-devel-1.0.6-4.el6.x86_64                                                                                                5/20

Verifying : freetype-devel-2.3.11-15.el6_6.1.x86_64                                                                                        6/20

Verifying : fontconfig-devel-2.8.0-5.el6.x86_64                                                                                            7/20

Verifying : xorg-x11-proto-devel-7.7-9.el6.noarch                                                                                           8/20

Verifying : libxslt-1.1.26-2.el6_3.1.x86_64                                                                                                9/20

Verifying : libXpm-3.5.10-2.el6.x86_64                                                                                                    10/20

Verifying : 2:libpng-devel-1.2.49-2.el6_7.x86_64                                                                                          11/20

Verifying : libXt-1.1.4-6.1.el6.x86_64                                                                                                    12/20

Verifying : libgpg-error-devel-1.7-4.el6.x86_64                                                                                            13/20

Verifying : libcurl-devel-7.19.7-46.el6.x86_64                                                                                            14/20

Verifying : libxslt-devel-1.1.26-2.el6_3.1.x86_64                                                                                         15/20

Verifying : gd-devel-2.0.35-11.el6.x86_64                                                                                                 16/20

Verifying : libX11-devel-1.6.0-6.el6.x86_64                                                                                               17/20

Verifying : 2:libpng-1.2.49-2.el6_7.x86_64                                                                                                18/20

Verifying : gd-2.0.35-11.el6.x86_64                                                                                                       19/20

Verifying : 2:libpng-1.2.49-1.el6_2.x86_64                                                                                                20/20

Installed:

freetype-devel.x86_640:2.3.11-15.el6_6.1         gd-devel.x86_64 0:2.0.35-11.el6                 libcurl-devel.x86_640:7.19.7-46.el6

libpng-devel.x86_64 2:1.2.49-2.el6_7               libxslt-devel.x86_640:1.1.26-2.el6_3.1

Dependency Installed:

fontconfig-devel.x86_64 0:2.8.0-5.el6            gd.x86_64 0:2.0.35-11.el6                        libX11-devel.x86_640:1.6.0-6.el6

libXau-devel.x86_64 0:1.0.6-4.el6                libXpm.x86_640:3.5.10-2.el6                    libXpm-devel.x86_64 0:3.5.10-2.el6

libXt.x86_64 0:1.1.4-6.1.el6                     libgcrypt-devel.x86_640:1.4.5-11.el6_4         libgpg-error-devel.x86_64 0:1.7-4.el6

libidn-devel.x86_64 0:1.18-2.el6                 libxcb-devel.x86_640:1.9.1-3.el6               libxslt.x86_64 0:1.1.26-2.el6_3.1

xorg-x11-proto-devel.noarch 0:7.7-9.el6

Dependency Updated:

libpng.x86_64 2:1.2.49-2.el6_7

Complete!

[[email protected] ~]# rpm -qa zlib-devellibxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel

libxml2-devel-2.7.6-20.el6_7.1.x86_64

libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64

zlib-devel-1.2.3-29.el6.x86_64

[[email protected] ~]# rpm -qafreetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel

gd-devel-2.0.35-11.el6.x86_64

freetype-devel-2.3.11-15.el6_6.1.x86_64

libpng-devel-1.2.49-2.el6_7.x86_64

libxslt-devel-1.1.26-2.el6_3.1.x86_64

libcurl-devel-7.19.7-46.el6.x86_64

[[email protected] ~]#

从以上的结果看出,仅有libiconv-devel这个包装没有安装,因为默认的yum源没有此包。可以采用编译安装的方式安装。

1.1.3 安装libiconv库

wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar xf libiconv-1.14.tar.gz

cd libiconv-1.14

./configure --prefix=/usr/local/libiconv

make

make install

1.1.4 安装libmcrypt库(非必须)

从repo源安装

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

yum install libmcrypt-devel -y

rpm -qa libmcrypt

1.1.5 安装mhash、mcrypt加密扩展库

yum install mhash mhash-devel -y

rpm -qa mhash mhash-devel

yum install mcrypt -y

rpm -qa mcrypt

1.2 PHP安装

1.2.1 解压配置PHP

[[email protected]]# tar xf php-5.3.27.tar.gz

[[email protected]]# cd php-5.3.27

[[email protected]]#  ./configure \

>--prefix=/application/php5.3.27 \

>--with-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-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

--with-mysql=/application/mysql:表示需要指定MySQL的安装路径,安装PHP需要的MySQL相关内容。如果没有MySQL软件包,也可以不单独安装,这样的情况可使用—with-mysql=mysqlnd。

正确的提示如下图所示:

1.2.2 编译PHP

[[email protected]]# make

出现下图所示表示编译正确

1.2.3 安装PHP文件到系统

[[email protected] php-5.3.27]# makeinstall

Installing PHP SAPImodule:       fpm

Installing PHP CLI binary:        /application/php5.3.27/bin/

Installing PHP CLI manpage:     /application/php5.3.27/man/man1/

Installing PHP FPMbinary:       /application/php5.3.27/sbin/

Installing PHP FPMconfig:       /application/php5.3.27/etc/

Installing PHP FPM manpage:     /application/php5.3.27/man/man8/

Installing PHP FPM statuspage:     /application/php5.3.27/share/php/fpm/

Installing buildenvironment:    /application/php5.3.27/lib/php/build/

Installing header files:          /application/php5.3.27/include/php/

Installing helperprograms:      /application/php5.3.27/bin/

program: phpize

program: php-config

Installing man pages:             /application/php5.3.27/man/man1/

page: phpize.1

page: php-config.1

Installing PEARenvironment:      /application/php5.3.27/lib/php/

[PEAR] Archive_Tar    - installed: 1.3.11

[PEAR] Console_Getopt -installed: 1.3.1

warning: pear/PEAR requirespackage "pear/Structures_Graph" (recommended version 1.0.4)

warning: pear/PEAR requirespackage "pear/XML_Util" (recommended version 1.2.1)

[PEAR] PEAR           - installed: 1.9.4

Wrote PEAR system config fileat: /application/php5.3.27/etc/pear.conf

You may want to add:/application/php5.3.27/lib/php to your php.ini include_path

[PEAR] Structures_Graph-installed: 1.0.4

[PEAR] XML_Util       - installed: 1.2.1

/home/local/tools/php-5.3.27/build/shtoolinstall -c ext/phar/phar.phar /application/php5.3.27/bin

ln -s -f/application/php5.3.27/bin/phar.phar /application/php5.3.27/bin/phar

Installing PDO headers:          /application/php5.3.27/include/php/ext/pdo/

[[email protected] php-5.3.27]#

出现上述结果表示安装完成。

1.2.4 配置PHP引擎配置文件php.ini

1、设置软链接访问方式

[[email protected] php-5.3.27]# ln-s /application/php5.3.27/ /application/php

[[email protected] php-5.3.27]# ll/application/php

lrwxrwxrwx 1 root root 23 Apr13 20:34 /application/php -> /application/php5.3.27/

[[email protected] php-5.3.27]#

2、查看PHP配置默认模板文件,并复制到PHP默认目录。

[[email protected] php-5.3.27]# ll/application/php

lrwxrwxrwx 1 root root 23 Apr13 20:34 /application/php -> /application/php5.3.27/

[[email protected] php-5.3.27]# lsphp.ini*

php.ini-development  php.ini-production

[[email protected] php-5.3.27]#vimdiff php.ini-development php.ini-production

2 files to edit

[[email protected] php-5.3.27]# cpphp.ini-production /application/php/lib/php.ini

[[email protected] php-5.3.27]#

1.2.5 配置PHP服务(FastCGI)的配置文件php-fpm.conf

[[email protected] php-5.3.27]# cd/application/php/etc/

[[email protected] etc]# ls

pear.conf  php-fpm.conf.default

[[email protected] etc]# cpphp-fpm.conf.default php-fpm.conf

[[email protected] etc]#

1.2.6 启动PHP服务(FastCGI)方式

[[email protected] etc]# /application/php/sbin/php-fpm

[[email protected] etc]# ps -ef|grepphp-fpm

root     54582    1  0 20:48 ?        00:00:00 php-fpm: master process(/application/php5.3.27/etc/php-fpm.conf)

nginx    54583 54582 0 20:48 ?        00:00:00 php-fpm:pool www

nginx    54584 54582 0 20:48 ?        00:00:00 php-fpm:pool www

root     54586 1660  0 20:48 pts/0    00:00:00 grep php-fpm

[[email protected] etc]# lsof -i:9000

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

php-fpm 54582  root   7u  IPv4  99975     0t0  TCP localhost:cslistener(LISTEN)

php-fpm 54583 nginx    0u IPv4  99975      0t0 TCP localhost:cslistener (LISTEN)

php-fpm 54584 nginx    0u IPv4  99975      0t0 TCP localhost:cslistener (LISTEN)

[[email protected] etc]#

1.3 配置Nginx支持PHP

1.3.1 修改Nginx配置文件

修改blog.conf文件内容为

[[email protected] extra]# catblog.conf

server {

listen       80;

server_name  blog.yifeng.com;

location / {

root   html/blog;

index  index.html index.htm;

}

location ~ .*\.(php|php5)?$ {

root html/blog;

fastcgi_pass127.0.0.1:9000;

fastcgi_indexindex.php;

include fastcgi.conf;

}

error_page   500 502 503 504  /50x.html;

location = /50x.html {

root   html;

}

access_loglogs/access_blog.log main;

}

[[email protected] extra]#

1.3.2 检查并启动Nginx

[[email protected] extra]#/application/nginx/sbin/nginx -t

nginx: the configuration file/application/nginx-1.8.1//conf/nginx.conf syntax is ok

nginx: configuration file/application/nginx-1.8.1//conf/nginx.conf test is successful

[[email protected] extra]#/application/nginx/sbin/nginx -s reload

[[email protected] extra]# lsof -i:80

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

nginx    1632 root   10u  IPv4 10879      0t0  TCP *:http (LISTEN)

nginx   54620 nginx  10u  IPv4  10879     0t0  TCP *:http (LISTEN)

[[email protected] extra]# lsof -i:9000

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

php-fpm 54582  root   7u  IPv4  99975     0t0  TCP localhost:cslistener(LISTEN)

php-fpm 54583 nginx    0u IPv4  99975      0t0 TCP localhost:cslistener (LISTEN)

php-fpm 54584 nginx    0u IPv4  99975      0t0 TCP localhost:cslistener (LISTEN)

[[email protected] extra]#

1.4 测试

1.4.1 测试PHP请求是否正确解析

[[email protected] blog]# echo"<?php phpinfo();?>" >test_info.php

[[email protected] blog]# ll

total 8

-rw-r--r-- 1 root root 26Apr  6 06:52 index.html

-rw-r--r-- 1 root root 19 Apr13 21:05 test_info.php

[[email protected] blog]# cattest_info.php

<?php phpinfo();?>

1.4.2 测试PHP接连MySQL是否正确

[[email protected] blog]# cattest_mysql.php

<?php

$link_id=mysql_connect(‘192.168.33.152‘,‘root‘,‘123456‘) ormysql_error();

if($link_id){

echo "mysql successful by root!";

}else{

echo mysql_error();

}

?>

[[email protected] blog]#

时间: 2024-08-03 10:52:59

PHP5.3版本安装的相关文章

centos系统php5.6版本安装gd扩展库

由于项目需要显示验证码登录系统,所以这里需要开启php的gd扩展 这边提供安装php5.6的yum方法扩展自选.# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm # yum install --enablerepo=remi -

CentOS yum 安装LAMP PHP5.4版本

CentOS yum 安装LAMP PHP5.4版本     [字体:大 中 小] Linux系统版本:CentOS 6.5 1.yum安装和源代码编译在使用的时候没啥区别,但是安装的过程就大相径庭了,yum只需要3个命令就可以完成,源代码需要13个包,还得加压编译,步骤很麻烦,而且当做有时候会出错,源代码编译安装大概需要2个小时,好处在于可以自己配置地址等一些参数,yum安装半个小时搞定,一般不会出错,更新也很方便. 2.我的机器是CentOS release 5.9 64为的系统,一般机器都

php5.4成功安装imageMagick, windows7下。(phpinfo中显示不出来是因为:1.imagick软件本身、php本身、php扩展三方版本要一致,2.需要把CORE_RL_*.dll多个文件放到/php/目录下面)

windows7下   php5.4成功安装imageMagick . (phpinfo中显示不出来是因为:1.软件本身.php本身.php扩展三方版本要一致,2.需要把CORE_RL_*.dll多个文件放到/php/目录下面) (作者:王奇疏 http://www.cnblogs.com/wangqishu/p/5609950.html ) 楼主需要用php处理一些特别的图片事宜,所以安装了iMagick for php来编写程序. 先看一下,这是我在windwos7安装成功的 imageMa

centos php 5.3升级到 php5.4版本

php5.3听说有bug,因此单独升级php5.3相关的版本到5.4 具体步骤: 下面是我之前的版本 之前php版本是: [[email protected] ~]# rpm -qa |grep php* php-5.3.3-46.el6_6.i686 php-pear-1.9.4-4.el6.noarch php-odbc-5.3.3-46.el6_6.i686 php-xml-5.3.3-46.el6_6.i686 php-cli-5.3.3-46.el6_6.i686 php-pdo-5.

Visual Studio 2013版本安装

这周老师布置了关于Visual Studio 2013版本安装过程的概述,下面我就分享给大家看吧! 首先要下载安装文件,等待下载完成之后,虽然下载文件是ios格式,但我们可以用解压缩工具解压打开.解压好后,双击vs_ultimate,开始安装. 自定义选择安装路径时,注意所属路径的预留空间要充足,否则安装会失败,同意许可条款,进行下一步. 在选择安装的可选功能这里,大家可以根据自己需要勾选,也可以默认全选. 等待大概30分钟,就可以完成安装.安装过程中,VS会占用很多的系统资源,所以最好不要开启

php5.4编译安装--nginx

1.下载源码包 wget 网址/源码包2.解压源码包 tar -zxvf 源码包3.创建一个安装目录 mkdir /usr/local/php4.进入解压后的目录中,初始化安装环境./configure \--prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--enable-fpm \--with-fpm-user=php-fpm \--with-fpm-group=php-fpm \--with-mysql=

php5.6编译安装apache

1.下载源码包wget 网址/php-5.6.30.tar.gz2.解压源码包tar -zxvf php-5.6.30.tar.gz3.创建一个安装目录mkdir /usr/local/php4.进入解压后的目录中,初始化安装环境:./configure \--prefix=/usr/local/php \--with-apxs2=/usr/local/apache/bin/apxs \--with-config-file-path=/usr/local/php/etc \--with-mysq

python多版本安装配置流程

情景:最新开始学习python,之前由于某个项目接触过python语言,但是那时候只是在项目平台上借助python这门工具语言罢了.趁着寒假这短暂的休闲时光,自己系统地开始学习python这门胶水语言,简易而全能.学习一门少不了一个开发工具的安装,同时目前python流行版本为2/3,所以为了方便使用,也知道pyhton可以多版本安装,故在自己的win7 32位电脑上进行多版本安装. 环境:WIN7 32位系统 软件包: python2.7.3和python3.5.3 问题:首先肯定是pytho

Cocos2d-x 2.0以上版本安装方法

1,cd 到2dx根目录,MAC平台使用./create-multi-platform-projects.py  然后提示: -bash: ./create-multi-platform-projects.py: /usr/bin/evn: bad interpreter: No such file or directory 没关系,我们打开.py文件,发现其实引用的是tools/project-creator/create_project.py 这文件 2,我们再cd 到tools/proje