更新时间:2022-10-04 10:57:41
安装环境:在web02上面安装php,web02已安装好了apache。
1 php下载安装:
打开网址http://mirrors.sohu.com,进入php目录,找到php-5.3.27.tar.xz 复制地址。
开始下载源码
1
2
|
[root@web02 ~] # cd /home/oldboy/tools
[root@web02 tools] # wget http://mirrors.sohu.com/php/php-5.3.27.tar.xz
|
1
2
3
4
5
|
[root@web02 tools] # ll
总用量 16408 drwxr-xr-x 12 1001 1001 4096 8月 27 21:55 httpd-2.2.34 -rw-r--r-- 1 root root 7684419 7月 10 21:29 httpd-2.2.34. tar .gz
-rw-r--r-- 1 root root 9109044 1月 21 2015 php-5.3.27. tar .xz
|
解压
1
2
|
[root@web02 tools] # tar xf php-5.3.27.tar.xz
[root@web02 tools] # cd php-5.3.27
|
2 安装基础包和安装过程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#####install php 5.3.27安装操作指导################ 安装php说明:mysql和php不是集成安装在本机的,本机先前已安装好了apache。 #####第一步安装相关包#### yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y
yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel -y
#####第二步安装libiconv-devel基础包################# 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
cd ../
#####第三步安装epel源############### wget -O /etc/yum .repos.d /epel .repo http: //mirrors .aliyun.com /repo/epel-6 .repo
yum -y install libmcrypt-devel mhash mhash-devel mcrypt -y
yum -y install libxslt-devel
yum install openssl-devel -y
######第四步下载并解压php-5.3.27.tar.xz,因php下载安装:已做了操作此步骤可以省略不用操作了#### [root@web02 ~] # cd /home/oldboy/tools
[root@web02 tools] # rz -y
- bash : rz: command not found
[root@web02 tools] # yum install lrzsz -y
[root@web02 tools] # rz -y #上传php-5.3.27.tar.xz
[root@web02 tools] # tar xf php-5.3.27.tar.xz
[root@web02 tools] # cd php-5.3.27
[root@web02 php-5.3.27] # pwd
/home/oldboy/tools/php-5 .3.27
#######第五步骤编译配置############# . /configure \
--prefix= /application/php5 .3.27 \
--with-apxs2= /application/apache/bin/apxs \
--with-mysql=mysqlnd \ --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 \
--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 \ -- enable - ftp
############################## 配置完成后提示:Thank you for using PHP.并且没有错误说明配置成功。
提示:本文中本地没有安装mysql,所以用--with-mysql=mysqlnd 使用此参数本地可以没有mysql软件包; 如果本地不需要开数据库,又不想用这个命令,就想指向上面这个路径,那么就把二进制包解压即可,不要初始化启动等,不需要。 #######第六步骤编译################ [root@web02 php-5.3.27] # make
make 成功结果如下:
Build complete. Don 't forget to run ' make test '.
#######第七步骤安装################ [root@web02 php-5.3.27] # make install
出现警告提示:libtool: warning: remember to run 'libtool --finish /home/oldboy/tools/php-5.3.27/libs' 忽略,不用理会
#######第八步做php link############# [root@web02 php-5.3.27] # ln -s /application/php5.3.27/ /application/php
[root@web02 php-5.3.27] # ls /application/php
bin etc include lib man
安装完后生成2个模块,如下所示 bin etc include lib man
[root@web02 php-5.3.27] # ls /application/apache/modules/
httpd.exp libphp5.so 这个模块实际上是在 /application/apache/conf/httpd .conf里面的
[root@web02 php-5.3.27] # grep libphp5.so /application/apache/conf/httpd.conf
LoadModule php5_module modules /libphp5 .so
接下来配置httpd支持 |
本文转自sandshell博客51CTO博客,原文链接http://blog.51cto.com/sandshell/1960323如需转载请自行联系原作者
sandshell