服务报价 | 域名主机 | 网络营销 | 软件工具| [加入收藏]
 热线电话: #
当前位置: 主页 > 开发教程 > linux教程 >

Centos 6安装完美搭建mysql、php、apache

时间:2016-01-02 03:22来源:未知 作者:最模板 点击:
You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [确定] 正在启动 mysqld: [确定] [root@centos mysql]# mysql Welcome to th



You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [确定]
正在启动 mysqld:                                          [确定]
[root@centos mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

mysql安装ok
 

安装php

[root@centos etc]# yum install php
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: mirrors.yun-idc.com
 * extras: mirrors.yun-idc.com
 * updates: mirrors.pubyun.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.i686 0:5.3.3-27.el6_5.2 set to be updated
--> Processing Dependency: php-common(x86-32) = 5.3.3-27.el6_5.2 for package: php-5.3.3-27.el6_5.2.i686
--> Processing Dependency: php-cli(x86-32) = 5.3.3-27.el6_5.2 for package: php-5.3.3-27.el6_5.2.i686
--> Running transaction check
---> Package php-cli.i686 0:5.3.3-27.el6_5.2 set to be updated
---> Package php-common.i686 0:5.3.3-27.el6_5.2 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                      Arch                   Version                            Repository                 Size
========================================================================================================================
Installing:
 php                          i686                   5.3.3-27.el6_5.2                   updates                   1.1 M
Installing for dependencies:
 php-cli                      i686                   5.3.3-27.el6_5.2                   updates                   2.2 M
 php-common                   i686                   5.3.3-27.el6_5.2                   updates                   527 k

Transaction Summary
========================================================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 3.9 M
Installed size: 13 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): php-5.3.3-27.el6_5.2.i686.rpm                                                             | 1.1 MB     00:04     
(2/3): php-cli-5.3.3-27.el6_5.2.i686.rpm                                                         | 2.2 MB     00:08     
(3/3): php-common-5.3.3-27.el6_5.2.i686.rpm                                                      | 527 kB     00:01     
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   259 kB/s | 3.9 MB     00:15     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
2:postfix-2.6.6-2.el6.i686 has missing requires of libmysqlclient.so.16
2:postfix-2.6.6-2.el6.i686 has missing requires of libmysqlclient.so.16(libmysqlclient_16)
2:postfix-2.6.6-2.el6.i686 has missing requires of mysql-libs
  Installing     : php-common-5.3.3-27.el6_5.2.i686                                                                 1/3 
  Installing     : php-cli-5.3.3-27.el6_5.2.i686                                                                    2/3 
  Installing     : php-5.3.3-27.el6_5.2.i686                                                                        3/3 

Installed:
  php.i686 0:5.3.3-27.el6_5.2                                                                                           

Dependency Installed:
  php-cli.i686 0:5.3.3-27.el6_5.2                           php-common.i686 0:5.3.3-27.el6_5.2                          

Complete!

 

配置apache

web application 项目路径 /var/www/html

apache配置文件路径 /etc/httpd/conf

[root@centos /]# cd /ect/httpd
[root@centos httpd]# ls -a
.  ..  conf  conf.d  logs  modules  run

[root@centos conf.d]# vim README

内容为:

This directory holds Apache 2.0 module-specific configuration files;
any files in this directory which have the ".conf" extension will be
processed as Apache configuration files.

Files are processed in alphabetical order, so if using configuration
directives which depend on, say, mod_perl being loaded, ensure that
these are placed in a filename later in the sort order than "perl.conf".

".conf"结尾的文件将被服务所处理,所以创建一个站点域名为文件名称的文件来实现域名绑定配置。

 

[root@centos conf.d]# vim git.com

<VirtualHost *:80>
        ServerAdmin novalue@qq.com
        DocumentRoot /var/www/html/git
        ServerName www.gittest.com
        ServerAlias gittest.com

        RewriteEngine On
        RewriteCond %{HPPT_HOST} ^gittest.com$ [NC]
        RewriteRule ^(.*)$ http://www.gittest.com$1 [L,R=301]

        ErrorLog logs/dummy-www.gittest.com-error_log
        CustomLog logs/dummy-www.gittest.com-access_log common
</VirtualHose>

 

启动httpd服务

[root@centos conf.d]# service httpd start
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
                                                           [确定]

 

 

訪问 http://192.168.1.10/ 

[root@centos conf.d]# cd /var/www/html
[root@centos html]# ls -a
.  ..
[root@centos html]# vim index.php

输入:
<?php
phpinfo();

訪问:http://192.168.1.10/

(责任编辑:最模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
热点内容