LAMP
一、Linux
操作系统:CentOS6.4
1.配置好可用的yum源
2.开发环境支持:
# yum groupinstall -y "Development tools"
# yum groupinstall -y "Server Platform Development"
Ubuntu13.04 安装 LAMP/Vsftpd/Webmin/phpMyAdmin 服务及设置http://www.linuxidc.com/Linux/2013-06/86250.htm
CentOS 5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12)http://www.linuxidc.com/Linux/2013-03/80333p3.htm
RedHat5.4下Web服务器架构之源码构建LAMP环境及应用PHPWindhttp://www.linuxidc.com/Linux/2012-10/72484p2.htm
LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHPhttp://www.linuxidc.com/Linux/2013-05/84882.htm
二、Apache
编译安装httpd-2.4.9
1.安装pcre-devel(依赖包)
#yum install pcre-devel -y
(关于pcre:http://www.linuxidc.com/Linux/2014-04/99536.htm)
#tar -xf apr-1.5.0.tar.bz2 -C /usr/src/
#cd /usr/src/apr-1.5.0
#./configure --prefix=/usr/local/apr //指定其安装位置
# make && make install
(关于apr:http://zh.wikipedia.org/wiki/Apache%E5%8F%AF%E7%A7%BB%E6%A4%8D%E8%BF%90%E8%A1%8C%E6%97%B6)
#tar -xf apr-util-1.5.3.tar.bz2 -C /usr/src/
# cd /usr/src/apr-util-1.5.3
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
#tar -xf httpd-2.4.9.tar.bz2 -C /usr/src
# cd /usr/src/httpd-2.4.9
# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=most --with-mpm=event
================================================================
释义:
--prefix=/usr/local/apache #→指定其安装位置
--sysconfdir=/etc/httpd #→指定配置文件安装位置
--enable-so #→启用基于DSO的方式动态加载模块
--enable-ssl #→启用基于https协议的功能
--enable-cgi #→启用基于cgi协议的功能
--enable-rewrite #→启用支持URL重写的功能
--with-zlib #→指定支持在互联网上发送数据报文时,通用的压缩库的API
--with-pcre #→指定支持poll的cgi
--with-apr=/usr/local/apr #→指定par的安装路径
--with-apr-util=/usr/local/apr-util/ #→指定par-util的安装路径
--enable-modules=most #→启用大多数常用的模块
--enable-mpms-shared=all #→启用加载所有的mpm模块
--with-mpm=event #→指定接下来httpd的工作模式是event
======================================================================
# make && make install
a).静态:使用--with-mpm=指定模块名称;一旦编译安装完成,无法卸载,只能从新编译安装。
b).动态:使用--enable-mpms-shared选项即可启用此特性。当给出的参数为all时,所有此平台支持的MPM模块都会被安装。可运行时加载,构建 MPM 为动态模块允许通过修改LoadModule指令内容来改变MPM,而不用重新编译安装。
配置:
a).设置pid文件的路径:
#vim /etc/httpd/httpd.conf //添加
PidFile "/var/run/httpd.pid"
#vim /etc/rc.d/init.d/httpd //修改
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
# chmod +x /etc/rc.d/init.d/httpd
# chkconfig --add httpd
# chkconfig --list httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig httpd on
# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# service httpd start
# ps -elFH
三、MySQL
1.安装
# tar xf mysql-5.5.33-linux2.6-x86_64.tar.gz -C /usr/local
# ln -sv /usr/local/mysql-5.5.33-linux2.6-x86_64 mysql 创建软连接,易于操作
# fdisk /dev/sda //10G
#pvcreate /dev/sda3 //创建物理卷
#vgcreate myvg /dev/sda8 //创建卷组
#lvcreate -L 8G -n mydata myvg //创建逻辑卷
#mke2fs -t ext4 /dev/myvg/mydata //格式化逻辑卷
# mkdir /mydata //创建逻辑卷挂载目录
#mkdri -pv /mydata/data //创建mysql数据存放目录
# vim /etc/fstab //添加开机自动挂载
/dev/myvg/mydata /mydata ext4 defaults 0 0
# mount -a //挂载
3.新建用户以安全方式运行进程
#groupadd -r mysql //创建系统组mysql
#useradd -r -s /sbin/nologin -g mysql mysql -M -D /mydata/data mysql
//创建系统用户mysql
#chown -R mysql:mysql /mydata/data
//设置目录属主属组
4.初始化mysql
# cd /usr/local/mysql
# scripts/mysql_install_db --datadir=/mydata/data --user=mysql
//初始化数据库
# chown -R root .
//设置当前目录所有文件属主为root
5.提供脚本
#cd /usr/local/mysql
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
//设置脚本mysqld
#chmod +x /etc/rc.d/init.d/mysqld
//给脚本执行权限
# chkconfig --add mysqld
//添加开机启动
# chkconfig mysqld on
6.提供配文件
#cd /usr/local/mysql
#cp support-files/my-large.cnf /etc/my.cnf
#vim /etc/my.cnf
thread_concurrency = 2
//修改,并发线程数,bithread_concurrency的值为CPU个数乘以2
datadir = /mydata/data
#添加,mysql数据文件的存放路径:
7.其他配置
# vim /etc/profile.d/mysqld.sh
export PATH=/usr/local/mysql/bin:$PATH
# source /etc/profile.d/mysqld.sh
#vim /etc/man.config
MANPATH /usr/local/mysql/man //添加此行
# ln -sv /usr/local/mysql/include /usr/include/mysql
//输出mysql的头文件至系统头文件路径/usr/include
# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
//输出mysql的库文件给系统库
#ldconfig //重载系统库:
# service mysqld start
# ss -rnl | grep 3306
#mysql
mysql> use mysql
mysql> select host,user,password from user;
mysql> DELETE FROM user WHERE user = ''; //删除空用户
mysql> DELETE FROM user WHERE user = '::1'; //删除ipv6用户
mysql> UPDATE user SET password = PASSWORD('Hoolee') WHERE password = '';
//为root用户设置密码
mysql> FLUSH PRIVILEGES;
更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2014-05/10187p2.htm

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools
