zoukankan      html  css  js  c++  java
  • Linux-Apache+Mysql+PHP+PHPWind(重点Apache+PHP集成环境)

    整理Apache+Mysql+PHP+PHPWind(Apache+PHP集成环境)

    一、情况简述:

    1、虚拟机VM上面CentOS

    2、全部yum安装(yum安装与源码安装的安装路径不同)

    二、操作步骤简述

    安装Apache(httpd)

    安装Mysql(mysqld)

    安装PHP(phpd-fdm)

    集成Apache+PHP

    安装PHPWind

    三、操作步骤详解

    1、安装Apache(httpd)

    yum install httpd httpd-devel httpd-manual httpd-tool

    其实就是httpd*

    然后安装apache扩展

    [root@localhost Packages]# yum install mod_ssl*

    如果有,就不用再安装了

    [root@localhost Packages]# ll mod_ssl*

    -r--r--r--. 2 root root 92248 Feb 23  2013 mod_ssl-2.2.15-26.el6.centos.x86_64.rpm

    使Apache可以自动启动

    [root@localhost Packages]# chkconfig --levels 235 httpd on

    启动Apache

    [root@localhost Packages]# service httpd status

    httpd is stopped

    [root@localhost Packages]# service httpd start

    Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

                                                               [  OK  ]

    [root@localhost Packages]#

    访问成功Apache:http://192.168.137.158/

    Apache端口80

    [root@localhost Packages]# netstat -anp | grep httpd

    tcp        0      0 :::80                       :::*                        LISTEN      2957/httpd     

    Apache安装路径:

    如果采用RPM包安装,安装路径应在 /etc/httpd目录下

    apache配置文件:/etc/httpd/conf/httpd.conf

    其他配置存储在 /etc/httpd/conf.d/ 目录

    Apache模块路径:/usr/sbin/apachectl

    web目录:/var/www/html

    如果采用源代码安装,一般默认安装在/usr/local/apache2目录下

    2、安装Mysql

    yum install mysql安装客户端

    yum install mysql-server安装服务端

    使mysql自动启动

    [root@localhost Packages]# chkconfig --levels 235 mysqld on

    启动服务

    [root@localhost Packages]# service mysqld status

    mysqld is stopped

    [root@localhost Packages]# service mysqld start

    Starting mysqld:                                           [  OK  ]

    mysql端口3306

    [root@localhost Packages]# netstat -anp | grep mysqld

    tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      3424/mysqld        

    unix  2      [ ACC ]     STREAM     LISTENING     28729  3424/mysqld         /var/lib/mysql/mysql.sock

    设置MySQLroot密码

    [root@localhost bin]# /usr/bin/mysqladmin -u root password '123456'

    访问mysql

    [root@localhost bin]# mysql -uroot -p

    Enter password:

    Welcome to the MySQL monitor.  Commands end with ; or g.

    Your MySQL connection id is 4

    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成功,并可对数据库进行增删改查

    mysql安装路径:

    如果采用RPM包安装,安装路径应在/usr/share/mysql目录下

    mysqldump文件位置:/usr/bin/mysqldump

    mysqli配置文件:

    /etc/my.cnf或/usr/share/mysql/my.cnf

    mysql数据目录在/var/lib/mysql目录下

    如果采用源代码安装,一般默认安装在/usr/local/mysql目录下

    3、安装php

    yum install *php*

    [root@localhost Packages]# rpm -qa | grep autoconf

    autoconf-2.63-5.1.el6.noarch

    启动服务

    [root@localhost bin]# service php status

    php: unrecognized service

    [root@localhost bin]# cd /etc/init.d

    [root@localhost init.d]# ll *php*

    -rwxr-xr-x. 1 root root 2060 Aug 11 13:36 php-fpm

    [root@localhost init.d]# service php-fpm status

    php-fpm is stopped

    [root@localhost init.d]# service php-fpm start

    Starting php-fpm:                                          [  OK  ]

    [root@localhost init.d]#

    php服务端口9000

    [root@localhost init.d]# netstat -anp | grep php-fpm

    tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      3554/php-fpm       

    unix  3      [ ]         STREAM     CONNECTED     30963  3554/php-fpm       

    unix  3      [ ]         STREAM     CONNECTED     30962  3554/php-fpm        

    访问php

    测试php:

    在/var/www/html下

    [root@localhost html]# vim info.php

    内容:

    <?php

     phpinfo();

     ?>

    访问页面:

    http://192.168.137.158/info.php

    4、集成apachephp

    apache(httpd)配置文件

    [root@localhost conf.d]# find / -name httpd.conf

    /etc/httpd/conf/httpd.conf

    修改上面配置文件:

    修改1:在LoadModule处添加

    LoadModule php5_module modules/libphp5.so

    修改2:在

    #

    # First, we configure the "default" to be a very restrictive set of

    # features. 

     

     

    ###############################################

    #<Directory />

    #   Options FollowSymLinks

    #    AllowOverride None

    #</Directory>

    #############################################

     

    下面添加:

    <Directory />

        Options FollowSymLinks

        AllowOverride None

        Order deny,allow

        Deny from all

        Allow from all

    </Directory>

    修改3:在AddType处添加

    AddType application/x-httpd-php .php .php5

    AddType application/x-httpd-php-source .phps

    修改4:在AddHandler处,添加

    AddHandler php5-script php

    修改5:在IfModule dir_module,添加#中内容。

    # DirectoryIndex: sets the file that Apache will serve if a directory

    # is requested.

    ###################################################

     

    <IfModule dir_module>

        DirectoryIndex  index.php  index.html

    </IfModule>

    #####################################################

    # The index.html.var file (a type-map) is used to deliver content-

    # negotiated documents.  The MultiViews Option can be used for the

    # same purpose, but it is much slower.

    #

    DirectoryIndex index.html index.html.var

    修改完成后,重启apache服务

                  

    php安装路径:

    如果采用RPM包安装,安装路径应在 /etc/目录下

    php的配置文件:/etc/php.ini

    如果采用源代码安装,一般默认安装在/usr/local/lib目录下

    php配置文件: /usr/local/lib/php.ini

    或/usr/local/php/etc/php.ini

    5、安装phpwind

    phpwind官网下载Linux版本

    解压unzip

    把解压后的upload复制到/var/www/html/下,并

    [root@localhost html]#  chmod -R 777 upload/

    然后访问页面:

    http://192.168.137.158:80/upload/install.php或

    http://192.168.137.158/upload/install.php

    默认密码admin/admin

    出现您已经安装过,需要重新安装请先删除data/install.lock文件

    [root@localhost data]# pwd

    /var/www/html/upload/data

  • 相关阅读:
    linux防火墙,高级策略策略实例详解(实例一)
    ftp文件共享服务详解
    使用nmap 验证多种漏洞
    powerCat进行常规tcp端口转发
    1111
    powershell下ssh客户端套件实现
    powershell加载EXE进内存运行
    44
    面对问题 认清自己
    22
  • 原文地址:https://www.cnblogs.com/Miss-Elsa/p/5818383.html
Copyright © 2011-2022 走看看