Heim > php教程 > php手册 > 构建WEB服务器的三大组件安装apache2+php5+mysql5

构建WEB服务器的三大组件安装apache2+php5+mysql5

WBOY
Freigeben: 2016-06-06 19:59:38
Original
817 Leute haben es durchsucht

+++++++++++++ mysql 安装: $ tar zxvf mysql-5.0.41.tar.gz $ cd mysql-5.0.41 # groupadd mysql # useradd -g mysql mysql # ./configure --prefix=/data/apps/mysql # make # make install # cp support-files/my-medium.cnf /etc/my.cnf # cd /data/apps

+++++++++++++
mysql 安装:
$ tar zxvf mysql-5.0.41.tar.gz
$ cd mysql-5.0.41
# groupadd mysql          
# useradd -g mysql mysql  
# ./configure --prefix=/data/apps/mysql
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /data/apps/mysql
# bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

apache 2 安装:

1、# Build and install apr 1.2
  # tar zxvf apr-1.2.9.tar.gz
# cd apr-1.2.9
#./configure --prefix=/data/apps/apr-httpd/
#make
#make install
2、# Build and install apr-util 1.2
# tar zxvf apr-util-1.2.8.tar.gz
# cd apr-util-1.2.8
# ./configure --prefix=/data/apps/apr-util-httpd /
> --with-apr=/data/apps/apr-httpd
#make
#make install
3、# Configure httpd

# tar jxvf httpd-2.2.4.tar.gz
# cd httpd-2.2.4
# vi config.sh 写入内容如下:
代码:

#!/bin/bash
HTTPD_ROOT="/data/apps/apache2"

./configure --prefix=$HTTPD_ROOT /
--with-apr=/data/apps/apr-httpd /
--with-apr-util=/data/apps/apr-util-httpd /
--enable-so /
--enable-rewrite /
--enable-info /
--enable-cgid /
--enable-mime-magic /
--enable-vhost-alias /
--enable-deflate /
--enable-expires /
--with-mpm=prefork

# sh config.sh
上面过程等同于直接
./configure --prefix=$HTTPD_ROOT /
--with-apr=/data/apps/apr-httpd /
--with-apr-util=/data/apps/apr-util-httpd /
--enable-so /
--enable-rewrite /
--enable-info /
--enable-cgid /
--enable-mime-magic /
--enable-vhost-alias /
--enable-deflate /
--enable-expires /
--with-mpm=prefork
# make
# make install  

+++++++++++++++++++++++++++++++++++++++++++++++++++++

安装php5
# tar jxvf php-5.2.3.tar.bz2
#cd php-5.2.3
$ vi config.sh 写入内容:
This extension is only available if PHP was configured with --enable-soap.
--enable-soap
代码:

#!/bin/bash
PHP_ROOT=/data/apps/php/
./configure --prefix=$PHP_ROOT /
            --with-apxs2=/data/apps/apache2/bin/apxs /
            --with-mysql=/data/apps/mysql /
            --enable-mbstring /
            --with-curl /
            --disable-debug /
            --enable-inline-optimization -q /
            --with-jpeg-dir=/usr/local/ /
            --with-png-dir /
            --enable-thread-safety /
            --enable-ctype /
            --with-bz2 /
            --with-zlib /
            --with-gd /
            --with-kerberos /
            --with-gettext /
            --enable-force-cgi-redirect /
            --with-iconv /
            --enable-gd-native-ttf /
            --enable-sockets /
            --with-snmp /
            --enable-ucd-snmp-hack
$sh config.sh
$ make
# make install
#cp php.ini-dist /data/apps/php/lib/php.ini

++++++++++++++++++++++++++++++++++++++++++++

基本配置

apache[/apache/conf/httpd.conf ]
修改
A. ServerAdmin webmaster@server.com
B. ServerName www.server.com:80

 
C. 
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all

D.
    DirectoryIndex index.html index.php

E.  AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

F. 启用MPM、Virtual hosts
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

E.修改MPM、Virtual Hosts

    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    ServerLimit         4000
    MaxClients          2000
    MaxRequestsPerChild   0


    ServerAdmin webmaster@server.com
    DocumentRoot /data/webapps
    ServerName server.com
    ErrorLog logs/server.com-error_log
    CustomLog logs/server.com-access_log common

测试:
在/apache2/htdocs 创建文件phpinfo.php 内容为:
代码:
echo phpinfo();
?>


在浏览器中打开 http://127.0.0.1/phpinfo.php 如果你能看到 phpinfo 界面那么ok。

 

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage