天天看点

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

什么是LAMP

目前最为成熟的一种企业网站应用模式,可提供动态Web站点应用及开发环境

构成组件

Linux、Apache、MySQL、PHP/Perl/Python

LAMP的优势

成本低廉

可定制、易于开发

方便易用、安全和稳定

实验案例:构建LAMP应用系统

需求描述

构建LAMP网站平台

安装并配置phpMyAdmin系统

实现思路

构建PHP运行环境

创建数据库并授权

安装并验证phpMyAdmin系统

之前已经搭建好了apache和mysql,下面开始php的安装

先安装数据加密等扩展工具(如libmcrypt、mhash、mcrypt)

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

libmcrypt的配置、编译、安装、优化路径

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

mhash的配置、编译、安装、优化路径

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

mcrypt的配置、编译、安装

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

解压PHP软件包

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

配置PHP

--prefix 指定安装目录

--with-mcrypt 加载数据加密等扩展工具支持

--with-apxs2 设置"apache http server"提供的apxs模块支持程序的位置

--with-mysql 设置MYSQL数据库服务程序的安装位置

--with-config-file-path 设置PHP的配置文件php.ini将要存放的位置

--enable-mbstring 启用多字节字符串功能

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

编译及安装

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

建立php.ini文件

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

修改php.ini文件

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

设置默认字符集为utf-8

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

允许通过PHP网页上传文件

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

允许上传的文件大小限制

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

每个HTTP请求最多允许上传的文件数

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

每次通过表单POST提交的数据量限制

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

允许识别PHP短语法标记,即<? ... ?>

添加ZendGuardLoader优化模块

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

调整httpd.conf配置文件.支持PHP页面解析

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

测试PHP网页能否正确显示

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

测试PHP网页能否访问MYSQL数据库

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

部署phpMyAdmin系统

解包并复制到网站根目录

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

建立配置文件config.inc.ph

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

在MYSQL数据库中添加elcdb库和elcadmin用户

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

登录phpMyAdmin系统

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

创建新的表

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

表及数据记录的管理

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统

导出SQL脚本文件

LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统
LAMP平台部署及应用(一) -- PHP的安装及配置和phpMyAdmin系统