zoukankan      html  css  js  c++  java
  • CentOS 6 LAMP Install (Apache MySQL & PHP) via YUM

    This tutorial will walk you through the process of installing a CentOS 6 LAMP server, LAMP stands for Linux Apache MySQL & PHP and is often refereed to as a “LAMP Stack“. CentOS is a popular choice for web servers as it’s based on RHEL (Redhat Linux), this tutorial will use YUM to install the required packages.

    This guide assumes you have a working fully updated CentOS 6 system with root access, if not see our CentOS 6 Netinstall tutorial.

    CentOS Apache Install via YUM

    The first step is to install the Apache web server, RHEL based distributions call this package httpd not Apache. Often admins get this command wrong and type “yum install apache” or “yum install apache2″ – the correct command to install Apache on CentOS is:

    yum install httpd

    Start Apache on CentOS:

    /etc/init.d/httpd start

    Add MySQL to start at boot type the following:

    chkconfig httpd on

    CentOS MySQL install via YUM

    Enter the following command to install CentOS MySQL Server and client via YUM:

    yum install mysql-server mysql

    Start MySQL on CentOS type:

    /etc/init.d/mysqld start

    Add MySQL to start at boot type the following:

    chkconfig mysqld on

    CentOS Install PHP & php-mysql via YUM

    To install PHP and php-mysql (php-mysql is required so that PHP can talk to MySQL) on CentOS 6 type:

    yum install php php-mysql

    FYI here is the full CentOS LAMP command (this will install Apache, MySQL & PHP all in one go):

    yum install httpd php php-mysql mysql mysql-server

    If you did everything right above you should see the CentOS test page if you browse to http://localhost (or your servers IP if you are on another box). If you don’t see a page below and it simply does not load chances are iptables is blocking httpd traffic you should configure iptables to allow httpd traffic however for now you  may want to disable the CentOS firewall.

    CentOS Apache Install Default Page

    I would recommend creating a file called index.php in /var/www/html/ and adding the following code to it:

    <?php phpinfo(); ?>

    This should give you an output similar to:

    CentOS PHP Install - phpinfo output

    If you see the above output all is will and you can install your web apps or start building them, if you have any problems and need help please drop me a comment below.

    注:

      1、phpinfo页面可能不执行问题

      原因一:conf.d/php.conf 配置不正确;

      原因二:使用的是<? phpinfo(); ?> php没有开启短标签支持

    # php.conf
    #
    # PHP is an HTML-embedded scripting language which attempts to make it
    # easy for developers to write dynamically generated webpages.
    #
    <IfModule prefork.c>
      LoadModule php5_module modules/libphp5.so
    </IfModule>
    <IfModule worker.c>
      LoadModule php5_module modules/libphp5-zts.so
    </IfModule>
    
    #
    # Cause the PHP interpreter to handle files with a .php extension.
    #
    AddHandler php5-script .php
    AddType text/html .php
    
    #
    # Add index.php to the list of files that will be served as directory
    # indexes.
    #
    DirectoryIndex default.php index.php
    
    #
    # Uncomment the following line to allow PHP to pretty-print .phps
    # files as PHP source code:
    #
    #AddType application/x-httpd-php-source .phps

    转自:

      kjs,CentOS 6 LAMP Install (Apache MySQL & PHP) via YUM,http://linuxmoz.com/centos-6-lamp-install/

    知识共享许可协议
    作品Tim Zhang创作,采用知识共享署名 3.0 中国大陆许可协议进行许可。 。
  • 相关阅读:
    [翻译] REMenu
    图片切换的效果
    刮奖效果
    粒子雪花效果
    Shimmer辉光动画效果
    解决Bootstrap 标签页(Tab)插件切换echarts不显示问题
    主要是解决,作为一个数据共享的数据库,存在的数据库统计,然后将计算的数据量输出到自己使用的数据库,进行主页面展示。
    使用kettle来根据时间戳或者批次号来批量导入数据,达到增量的效果。
    使用java的Calendar工具类获取到本月的第一天起始时间和最后一天结束时间。
    mysql根据分组和条件查询以后如何统计记录的条数
  • 原文地址:https://www.cnblogs.com/ccdc/p/2508722.html
Copyright © 2011-2022 走看看