Lamp源码搭建

Lamp

Centos6.5 + Apache/2.2.29 + PHP 5.3.29 + Mysql5.6.20

 

Apache(/usr/local/apache)

 

PHP(/usr/local/bin/php)

 

Mysql(/usr/local/mysql)

 

yum install gcc zlib-devel -y

Apache cat /usr/local/apache/build/config.nice

./configure --prefix=/usr/local/apache --enable-so --enable-modules=all --enable-mods-shared=all

make && make install

--enable-so 动态共享对象

 

Mysql(mysql-advanced-5.6.20-linux-glibc2.5-x86_64)(二进制包安装)

yum install libaio-devel libaio -y

useradd -M -d /dev/null -s /sbin/nologin mysql

cd /usr/local

ln -s mysql-advanced-5.6.20-linux-glibc2.5-x86_64 mysql

cp mysql-advanced*/support-files/my-default.cnf /etc/my.cnf

cp mysql-advanced*/support-files/mysql.server /etc/init.d/mysqld

chmod 755 /etc/init.d/mysqld

cd mysql

chown -R mysql:mysql .

vim /etc/my.cnf

  [client]

  socket = /var/lib/mysql/mysql.sock #一定要加[client下] client连接时 默认以为mysql.sock在/tmp/mysql.sock下 所以报错Can't connect to local MySQL server through socket '/tmp/mysql.sock'

  datadir = /usr/local/mysql/data

  port = 3306

  socket = /var/lib/mysql/mysql.sock

  user = mysql

  pid-file = /var/run/mysql/mysqld.pid

  [mysqld_safe]

  log-error=/var/log/mysqld.log

mkdir /var/lib/mysql

chown mysql:mysql /var/lib/mysql

#安装

scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

#启动mysql

bin/mysqld_safe --user=mysql &

 

Php

yum install libxml2 libxml2-devel -y

./configure --with-apxs2=/usr/local/apache/bin/apxs --enable-mbstring --without-sqlite  --without-sqlite3 --without-pdo-sqlite --with-mysql=/usr/local/mysql

make && make install

cp php.ini-production  /usr/local/lib/php.ini

 

vim /usr/local/apache/conf/httpd.conf

AddType application/x-httpd-php .php

 

#检查apache是否有php模块

apachectl -M | grep php

 

#检查php中是否有mysql模块

php -i | grep mysql

 

#查看此lamp架构中的各个模块(ip 192.168.1.2)

192.168.1.2/phpinfo.php

posted @ 2014-09-10 16:20  metasequoia  阅读(186)  评论(0编辑  收藏  举报