讲解关于centos配置apache+php安装

系统 Linux
下边编译centos配置这个需要一点时间的。下边简单说说编译centos配置的这些的意思,

centos配置apache+php文件是常用系统文件,于是我研究了一下关于apache+php的centos配置安装,这里我发表一下centos配置安装个人理解。

centos配置apache+php

首先;
下载软件;
apache下载地址http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz
php下载地址:http://cn.php.net/distributions/php-5.2.6.tar.gz
mysql下载地址:http://mysql.ntu.edu.tw/Downloads/MySQL-5.0/mysql-5.0.51a-linux-i686-glibc23.tar.gz

首先
[root@localhost ]# wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz
--00:47:30--  http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz
Resolving apache.mirror.phpchina.com... 221.194.139.225
Connecting to apache.mirror.phpchina.com|221.194.139.225|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6396996 (6.1M) [application/x-gzip]
Saving to: `httpd-2.2.9.tar.gz.1'
0% [] 36,300    41.3K/s
[root@localhost ]tar zxvf httpd-2.2.9.tar.gz

下边解压
httpd-2.2.9/srclib/apr-util/test/abts_tests.h
httpd-2.2.9/srclib/apr-util/test/data/
httpd-2.2.9/srclib/apr-util/test/dbd.c
httpd-2.2.9/srclib/apr-util/test/Makefile.in
httpd-2.2.9/srclib/apr-util/test/Makefile.win
httpd-2.2.9/srclib/apr-util/test/nw_misc.c
httpd-2.2.9/srclib/apr-util/test/nwgnuaputest
此处省略N字.

接着进入
[root@localhost ~]cd httpd-2.2.9下边编译apache
[root@localhost httpd-2.2.9]./configure --prefix=/usr/local/apache --enable-track-vars --enable-cgi --with-config-file-path=/usr/local/apache/conf
下边编译centos配置这个需要一点时间的。
下边简单说说编译centos配置的这些的意思,
prefix=//usr/local/mysql/apache 指定把apahce安装到//usr/local/mysql/apache目录中;
enable-cgi 支持CGI;
with-config-file-path=//usr/local/mysql/apache/conf 指定把apache的配制文件放在//usr/local/mysql/apache/conf中;比如httpd.confcentos配置文件就在这个目录中;
enable-track-vars 为启动cookie的get/post等追踪功能
差不多编译好了。会提示apache安装成功,
[root@localhost ]make; make install //接着输入编译这个命令很简单就是make;make install即可!
接着输入开启apache服务。
[root@localhost ] server httpd restart
到此处apache安装成功
删除默认页
rm -f /usr/local/apache/conf.d/welcome.conf即可看到可爱的403错误!

centos配置安装php;
[root@localhost ~]# tar zxvf php-5.2.6.tar.gz //解压php文件
[root@localhost ~]# cd php-5.2.6 //进去php安装目录
[root@localhost php-5.2.6]#]#./configure --prefix=//usr/local/mysql/php --with-mysql=//usr/local/mysql/mysql --with-apxs2=//usr/local/mysql/apache/bin/apxs --enable-track-vars --enable-force-cgi-redirect --with-config-file-path=//usr/local/mysql/php/etc   //编译php

安装:[root@localhost php-5.2.6]#make
[root@localhost php-5.2.6]#make install
复制php.ini-dist为php.ini,并存放到/usr/local/php目录下!
[root@localhost php-5.2.6]# cp php.ini-dist /usr/local/php/php.ini
编辑/usr/local/php/php.ini文件,找到如下的一行
;default_charset = "iso-8859-1"
在这行下面加一行
default_charset = "gb2312
//下边组合apache+php
找到#AddType application/x-tar .tgz 这行,在下面加一行。前面不要加#号。

AddType application/x-httpd-php .php
找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php
DirectoryIndex index.html index.html.var index.php
让后我们顺手下个测试php的页面吧
编辑vi /usr/www/html/test.php写入
echo >> <?phpinfo();?> /usr/www/html/test.php即可,到此处php+apache安装成功
以上介绍centos配置apache+php安装。

【编辑推荐】

  1. CentOS配置VSFTPD服务器与SSH
  2. CentOS配置安装相关常用系统
  3. Centos设置静态IP及修改Centos配置文件
  4. 简介CentOS配置ssh系统技术
  5. Linux发行版的CentOS与RHEL有各种很复杂的关系
责任编辑:佚名 来源: CSDN
相关推荐

2011-03-09 10:50:27

Linuxapachephp

2010-02-22 17:53:14

CentOS配置

2010-01-13 16:55:10

CentOS PHP安

2010-01-14 16:53:40

CentOS Apac

2009-11-17 13:39:48

PHP5.0安装

2014-08-05 16:30:12

CentOS6LAMP

2010-01-14 15:56:29

2010-01-14 13:47:30

CentOS extm

2010-06-01 09:51:11

2011-03-08 11:11:38

LinuxLAMP安装

2011-03-08 11:11:38

LinuxLAMP安装

2010-05-04 13:41:04

Unix平台

2009-06-29 13:57:28

linuxapachephp

2009-11-18 10:39:45

PHP5配置

2009-12-09 13:32:08

PHP zend安装

2011-03-21 13:59:44

Apachemysqlphp

2010-01-13 15:53:11

CentOS vsft

2010-03-30 09:06:26

CentOS安装

2010-04-01 09:31:16

CentOS系统

2010-04-01 15:05:05

CentOS系统
点赞
收藏

51CTO技术栈公众号