• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
8, lamp
 

8, lamp

on

  • 278 views

About LAMP, how to setup.

About LAMP, how to setup.

Statistics

Views

Total Views
278
Views on SlideShare
250
Embed Views
28

Actions

Likes
0
Downloads
0
Comments
0

4 Embeds 28

http://ebshome.blogspot.com 15
http://ebshome.blogspot.jp 10
http://ebshome.blogspot.sg 2
http://translate.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    8, lamp 8, lamp Presentation Transcript

    • LAMP
    • 概述• LAMP是一种目前很流行的建站方式, LAMP 指的是Linux+Apache+MySQL+PHP, 这里依次解 释后面三个: Apache 最流行的web服务器, 什么是web server 参考这里, Apache官方网站. MySQL 开源数据库服务器, 特点是小巧高效 PHP 网页脚本引擎, 输出HTML脚本• 这里会讲述如何使用搭建LAMP环境并建立一 个内容管理(CMS)站点, 前提是需要对WEB有一 定的概念.
    • LAMP - 安装 & apache• 准备源代码包 httpd-2.2.22.tar.bz2 MySQL-5.5.17-1.rhel5.src.rpm php-5.3.14.tar.bz2• apache安装及配置 1, 安装 tar jxvf httpd-2.2.22.tar.bz2 # 解压缩 # 切换到解压缩后的目录, 运行configure ./configure --prefix=/usr/local/apache2 --enable-mods- shared=most --enable-so --enable-rewrite # 编译安装 make && make install
    • LAMP - 安装 & apache 2, apache配置 通常将httpd配置为系统服务, 如下: # 拷贝系统服务脚本cp /usr/local/apache2/bin/httpd /etc/init.d # 添加系统服务 chkconfig --add httpd chkconfig httpd --level 35 on 3, web根目录设置, 添加PHP支持 在apache安装目录下找到httpd.conf文件, 参考如下配置: DocumentRoot "/apps" <Directory "/apps"> DirectoryIndex index.html index.phpAddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps
    • LAMP - 安装 & mysql• mysql安装及配置 1, 安装 # 解压缩 rpm2cpio MySQL-5.5.17-1.rhel5.src.rpm | cpio –id tar zxvf mysql-5.5.17.tar.gz # 在安装mysql需要确保cmake, bison, ncurses-devel已安装 tar zxvf cmake-2.8.8.tar.gz cd cmake-2.8.8 ./configure && make && make install yum install bison.i386 yum install ncurses-devel # 编译安装mysql, cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data make && make install
    • LAMP - 安装 & mysql2, mysql基础配置# mysql配置文件mkdir /var/mysqlcp /usr/local/mysql/support-files/my-huge.cnf /var/mysql/my.cnf# 创建mysql用户和组, 创建数据文件目录并更改权限groupadd mysqluseradd -g mysql mysqlchown -R mysql:mysql /var/mysqlchown -R mysql:mysql /data# 初始化mysql字典数据库/usr/local/mysql/scripts/mysql_install_db --defaults-file=/var/mysql/my.cnf --basedir=/usr/local/mysql --datadir=/data --user=mysql# 配置系统服务cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldchkconfig --add mysqldchkconfig --level 35 mysqld on
    • LAMP - 安装 & mysql# 修改my.cnf, 类似如下修改:[mysqld]datadir=/datasocket=/tmp/mysql.sockuser=mysql[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid[client]socket=/tmp/mysql.sock# 启用mysql日志修改my.cnf文件在mysqld段添加: log=”/data/mysql.log”# 允许root远程连接grant all on *.* to root@% identified by abc123;flush privileges;
    • LAMP - 安装 & PHP• PHP安装 根据需要安装libxml2-devel: yum install libxml2-devel.i386 解压后使用如下如下命令安装php: ./configure --prefix=/usr/local/php --with- apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file- path=/usr/local/php --with-zlib=/usr make && make install
    • LAMP - 测试• 在web根目录下分别创建如下两个php脚本文件: 1, test1.php 测试php安装是否成功 <?php phpinfo(); ?> 2, test2.php 测试是否能够连接mysql <? $link = mysql_connect(localhost,root,root); if(!$link) echo "Failure!"; else echo "Success!"; mysql_close(); ?>