apache+mysql+php 源码安装

本文详细介绍如何从零开始部署LAMP(Linux, Apache, MySQL, PHP)环境,包括Apache Web服务器、MySQL数据库及PHP解析器的安装配置过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.httpd-2.2.3.tar.gz
gunzip < httpd-2.2.3.tar.gz |tar -xvf -
cd httpd-2.2.3
./configure
make
make install

启动:/usr/local/apache2/bin/apachectl start

2.mysql-5.0.22.tar.gz
groupadd mysql
useradd -g mysql mysql
gunzip < mysql-5.0.22.tar.gz |tar -xvf -
cd mysql-5.0.22
./configure --prefix=/usr/local/mysql --with-charset=gb2312
make
make install
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
bin/mysql_install_db --user=mysql //用来安装数据库文件
chown -R root
chown -R mysql var
chgrp -R mysql
启动 bin/mysqld_safe --user=mysql &

3.php-5.2.0.tar.gz
gunzip < php-5.2.0.tar.gz |tar -xvf -
cd php-5.2.0
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars --enable-force-cgi-redirect --with-config-file-path=/usr/local/apache/conf
make
make install
cp php.ini-dist /usr/local/apache/lib/php.ini

 编辑php.ini文件:
查找:
;default_charset = "iso-8859-1"
在这行下面加一行
default_charset = "gb2312"

# 编辑apache的 httpd.conf文件:
查找:
DirectoryIndex index.html
在后面加入 index.php 让apache也能打开默认首页为php的文件。
查找:
#AddType application/x-tar .tgz
在下面加入
AddType application/x-httpd-php .php

重启apache 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值