Linux下服务器搭建实战:MySQL+PHP+Apache
首先安装mysql,
解压,安装,安装的配置命令如下:
./configure --prefix=/home/work/luyao/web/mysql --enable-assembler \--with-mysqld-ldflags=-all-static --localstatedir=/home/work/luyao/web/mysql/data \--with-unix-socket-path=/home/work/luyao/web/mysql.sock --enable-assembler \--with-charset=gb2312 --with-low-memory
make
make install
安装完成之后需要注意拷贝my.cnf文件,笔者采用的是非root安装方式,因此在安装目录下新建etc文件夹,拷贝资源包中的my-mediem.cnf为my.cnf
./mysqld
./mysqladmin -u root password ***;
./mysql
DONE
apache安装:
1.首先安装apr和apr-util
从安装包中跳转到apr的目录,然后执行:
./configure --prefix=/path/to/install && make && make install
2.同理,安装apr-util;
3.修改apache的源文件,位置:sever/mpm/worker/worker.c,按照自己的喜欢修改即可
4.配置apache:
./configure --prefix=/home/work/luyao/web/apache/apache --enable-mods-shared=all --enable-so --with-mpm=worker --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-proxy --enable-rewrite --enable-charset-lite --enable-suexec --with-suexec-bin=/usr/sbin/suexec --disable-ipv6 -disable-dav --with-apr=/home/work/luyao/web/apache/apr --with-apr-util=/home/work/luyao/web/apache/apr-util/
5.make && make install
6.修改httpd.conf中的监听端口,启动httpd
7. 访问ip+port即可看见apache的测试页面,it works!恭喜。
安装php
1. 配置
/configure --prefix=/home/work/luyao/web/php5 --with-apxs2=/home/work/luyao/web/apache/apache/bin/apxs --with-mysql=/home/work/luyao/web/mysql/ --with-curl=/home/work/luyao/web/curl/ --enable-pcntl --enable-sqlite-utf8 --enable-sockets --with-mysqli=/home/work/luyao/web/mysql/bin/mysql_config --enable-track-vars --enable-ftp
2.安装
make && make install
3.拷贝配置文件
cp php.ini-devlopment php_dir/bin/