buhong 发表于 2018-11-25 10:47:21

源码编译安装lamp(linux+apache+mysql+php)

  
  

  tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/
make
make install
cd ..

tar zxvf freetype-2.4.10.tar.gz
cd freetype-2.4.10
./configure --prefix=/usr/
make
make install
cd ..

tar jxvf libxml2-2.6.30.tar.bz2
cd libxml2-2.6.30
./configure --prefix=/usr/
make
make install

tar jxvf httpd-2.2.23.tar.bz2
cd httpd-2.2.23/srclib/apr
./configure --prefix=/usr/local/apr
make ; make install
cd ../apr-util
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make ; make install
cd ../../
./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-so
make
make install

  

  groupadd mysql
  useradd -g mysql mysql

  tar zxvf mysql-5.1.65.tar.gz
cd mysql-5.1.65
./configure --prefix=/usr/local/mysql/ --enable-assembler \
--with-extra-charsets=complex \
--enable-thread-safe-client \
--with-big-tables \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase,myisammrg
make
make install

  cp support-files/my-medium.cnf /usr/local/mysql/my.cnf
  mkdir /usr/local/mysql/data
chown -R mysql.mysql /usr/local/mysql/data/
  vim /usr/local/mysql/my.cnf
  在标签下添加如下两行:
basedir=/usr/local/mysql      --定义mysql的目录位置
datadir=/usr/local/mysql/data      --定义mysql数据目录的位置

  /usr/local/mysql/bin/mysql_install_db --defaults-file=/usr/local/mysql/my.cnf --user=mysql    --初始化mysql 数据库
  /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf --user=mysql &      --开启mysql服务
  

  tar zxvf php-5.4.7.tar.gz
cd php-5.4.7
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-libxml-dir --with-gd --with-png-dir --with-jpeg-dir --with-freetype-dir=/usr --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-sockets --enable-exif --disable-ipv6
make
make install


【apache结合php】

Apache主配置文件为:/usr/local/apache/conf/httpd.conf
# vim /usr/local/apache/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加
AddType application/x-httpd-php .php

找到:

DirectoryIndex index.html

将该行改为

DirectoryIndex index.html index.htm index.php


  



页: [1]
查看完整版本: 源码编译安装lamp(linux+apache+mysql+php)