linux下安装apache+PHP过程
安装apache过程总结
安装httpd-2.2.11
下载地址:http://archive.apache.org/dist/httpd/
安装过程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
[root@zhibing /]# rpm -qa |grep httpd
httpd-manual-2.0.52-32.ent
httpd-suexec-2.0.52-32.ent
system-config-httpd-1.3.1-1
httpd-2.0.52-32.ent
[root@zhibing /]# rpm -e httpd --nodeps
[root@zhibing tmp]# tar zxvf httpd-2.2.11.tar.gz
[root@zhibing tmp]# cd httpd-2.2.11
[root@zhibing httpd-2.2.11]# ./configure --prefix=/usr/local/apache --enable-s0
[root@zhibing httpd-2.2.11]# make
[root@zhibing httpd-2.2.11]# make install
|
安装 php-5.2.9
下载地址:http://cn.php.net/downloads.php
注意:安装php-5.2.9之前,png,gd,freetype,zlib,mysql,openssl都存在,若不存在,手动安装一下
安装过程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
[root@zhibing tmp]# tar zxvf php-5.2.9.tar.gz
[root@zhibing tmp]#cd php-5.2.9.tar.gz
[root@zhibing php-5.2.9]#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-png-dir --with-gd --with-freetype-dir --with-zlib --with-mysql=/usr/local/mysql --with-openssl --with- gettext -enable-sockets
[root@zhibing php-5.2.9]#make && make install
[root@zhibing php-5.2.9]#cp php.ini-recommended /usr/local/php/lib/php.ini
[root@zhibing php-5.2.9]#ln -s /usr/local/php/bin/* /usr/local/bin/
ot@zhibing php-5.2.9]#lvi /usr/local/apache/conf/httpd.conf
|
添加
1
2
3
|
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType p_w_picpath/x-icon .ico
|
添加
1
2
3
4
|
index.php index.html index.html. var
<IfModule dir_module>
DirectoryIndex index.html index.php index.html index.html. var
</IfModule>
|
测试:
1
2
|
[root@zhibing ]#vi /usr/local/apache/htdocs/test.php
|
在新文件中添加
wq保存退出
Phpinfo是特殊的php函数,可以显示目前服务器内php模块的相关核心数据
1
2
3
4
|
[root@zhibing ]## /usr/local/apache/bin/apachectl –k stop
[root@zhibing ]##/usr/local/apache/bin/apachectl –k start
|
在浏览器中输入主机地址例如http://主机IP/test.php如有出现下面图片就说明apace安装成功
以上就是linux下如何安装apache php的详细内容,更多请关注php中文网其它相关文章!