linux下安装apache php的方法:首先下载“httpd-2.2.11”并解压安装包 ;然后通过“make install”进行编译安装;接着下载php并进行编译安装;最后修改配置文件即可。

linux下安装apache+PHP过程
安装apache过程总结
佳弗网络竞拍系统6.0版本 环境需求 1. 可用的 www 服务器,如 Apache、Zeus、IIS 等 2. php 4.3.0 及以上 3. Zend Optimizer 2.5.7 及以上 4. MySQL 3.23 及以上,仅针对 MySQL 版 安装 1.安装按照提示流程一步一步安装 2.安装过后如果出现错误,请删除 ./admin/Runtime 和 ./app/Runtime
0
立即学习“PHP免费学习笔记(深入)”;
立即学习“PHP免费学习笔记(深入)”;
安装httpd-2.2.11
下载地址:http://archive.apache.org/dist/httpd/
立即学习“PHP免费学习笔记(深入)”;
安装过程
[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
//查看本机是否已经安装httpd
[root@zhibing /]# rpm -e httpd --nodeps
//删除本机存在的httpd
[root@zhibing tmp]# tar zxvf httpd-2.2.11.tar.gz
//解压安装包
[root@zhibing tmp]# cd httpd-2.2.11
//进入httpd-2.2.11
[root@zhibing httpd-2.2.11]# ./configure --prefix=/usr/local/apache --enable-s0
//检测程序, --prefix 软件要安装的路径–enable-so表示让apache核心装载DSO,但是不实际编译任何动态模块
[root@zhibing httpd-2.2.11]# make
//编译
[root@zhibing httpd-2.2.11]# make install
//编译后安装
立即学习“PHP免费学习笔记(深入)”;
安装 php-5.2.9
下载地址:http://cn.php.net/downloads.php
注意:安装php-5.2.9之前,png,gd,freetype,zlib,mysql,openssl都存在,若不存在,手动安装一下
立即学习“PHP免费学习笔记(深入)”;
安装过程
立即学习“PHP免费学习笔记(深入)”;
[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
//拷贝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
//修改配置文件添加
AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php AddType p_w_picpath/x-icon .ico
添加
index.php index.html index.html.var
<IfModule dir_module>
DirectoryIndex index.html index.php index.html index.html.var
</IfModule>
立即学习“PHP免费学习笔记(深入)”;
立即学习“PHP免费学习笔记(深入)”;
测试:
[root@zhibing ]#vi /usr/local/apache/htdocs/test.php //新建test.php
在新文件中添加
<?php phpinfo(); ?>
wq保存退出
Phpinfo是特殊的php函数,可以显示目前服务器内php模块的相关核心数据
立即学习“PHP免费学习笔记(深入)”;
[root@zhibing ]## /usr/local/apache/bin/apachectl –k stop
[root@zhibing ]##/usr/local/apache/bin/apachectl –k start
//重新启动apache
立即学习“PHP免费学习笔记(深入)”;
立即学习“PHP免费学习笔记(深入)”;
在浏览器中输入主机地址例如http://主机IP/test.php如有出现下面图片就说明apace安装成功

以上就是linux下如何安装apache php的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号