SUSE-linux-64bit下编译32bit-apache-mysql-php

( 全部编译 32bit)
以上 3 个软件下所有依赖库全部跟着一起安装成 32bit
 
 
rpm -qa|egrep "(freetype|xml2|jpeg|png|gd|zlib|mcrypt)"|grep 32bit
                         i.              zlib-32bit-1.2.3-106.34
                         ii.              freetype2-32bit-2.3.7-25.8
                         iii.              libxml2-32bit-2.7.1-10.8
                         iv.              libpng12-0-32bit-1.2.31-5.10
                         v.              zlib-devel-32bit-1.2.3-104.137
                         vi.              libpng-devel-32bit-1.2.31-4.23
检查是否安装好了各种依赖库
Ps: 全部源程序放在 /usr/local/src      编译后的程序放在 /usr/local/***
安装 apache2
tar  -xvf apache2-***.tar
cd apache***
 CC="gcc" CFLAGS="-O3 -m32" CXXFLAGS="-O3 -m32" \
./configure --prefix=/usr/local/apache2   --disable-asis   --disable-auth   --disable-autoindex    --disable-access    --disable-userdir    --enable-charset-lite    --enable-deflate   --enable-expires   --enable-headers   --enable-rewrite   --enable-so   --with-included-apr
 
Make
Make install
安装 mysql5
Tar   -xvf mysql***.tar
Cd  mysql***
CC=gcc    CFLAGS="-O3 -m32" CXXFLAGS="-O3 -m32"    -felide-constructors \
            -fno-exceptions -fno-rtti"  ./configure \
            --prefix=/usr/local/mysql --enable-assembler \
            --with-mysqld-ldflags=-all-static \
            --with-client-ldflags=-all-static \
            --localstatedir=/data/mysql --without-debug \
             --enable-thread-safe-client --without-docs \
            --with-big-tables --enable-local-infile  --enable-shared \
            --with-charset=latin1 --with-extra-charsets=gbk,gb2312,utf8
Make
Make install
启动sql------------------------------------------
Cd /usr/local/mysql
useradd mysql   ////// 添加 mysql 这个用户
chown -R mysql:root /usr/local/mysql/   \\\\\\\使msyql5软件里的东西归  mysql 用户所拥有
bin/mysql_install_db --user=mysql  --basedir=/usr/local/mysql --datadir=/data/mysql
cp share/mysql/my-medium.cnf /etc/my.cnf
bin/mysqld_safe �C user=mysql &  \\\\\\\\\\\\\\ 这里启动 mysql
 
安装 php5
  Tar �Cxvf php5***.tar
  Cd php5***
 
CFLAGS="-O3 -m32" CXXFLAGS="-O3 -m32" ./configure  
--prefix=/usr/local/php
--with-apxs2=/usr/local/apache2/bin/apxs
--with-zlib
--with-gd --enable-mbstring
--with-mysql=/usr/local/mysql
--with-mysqli=/usr/local/mysql/bin/mysql_config
--with-pdo-mysql=/usr/local/mysql
--with-config-file-path=/usr/local/php
--with-iconv
--disable-ipv6
--enable-static
--with-libxml-dir
--with-jpeg-dir=/usr/local/jpeg6
--with-png-dir
--with-freetype-dir      
--with-mcrypt=/usr/local/libmcrypt
--with-zlib-dir         ///////// 这里的依赖库要是以源码安装, 的写with-zlib- 路径; 以寻找依赖库
 
  Make 
  Make install
Cp php.ini-dist /usr/local/php/php.ini
 
 
相关依赖库的源码安装
在编译 php5 之前安装的
编译   jpeg
 
mkdir -p /usr/local/jpeg6
mkdir -p /usr/local/jpeg6/bin
mkdir -p /usr/local/jpeg6/lib
mkdir -p /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man
mkdir -p /usr/local/jpeg6/man1
mkdir -p /usr/local/jpeg6/man/man1     ////////////// 这里在安装前 mkdir
 
tar -zvxf jpegsrc.v6b.tar.gz
cd jpeg-6b
编译
CFLAGS="-O3 -m32" CXXFLAGS="-O3 -m32"  ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
Make
Make install
 
zlib 安装
cd /usr/local/src
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
CFLAGS="-O3 -m32" CXXFLAGS="-O3 -m32"   ./configure --prefix=/usr/local/zlib
 
Libxml2 安装
tar -xjvf libxml2-2.6.23.tar.bz2           或者      tar -zxvf libxml2-6.23.tar.gz
cd libxml2-2.6.23
CFLAGS="-O3 -m32" CXXFLAGS="-O3 -m32"  ./configure --prefix=/usr/local/libxml2
 
安装 freetype
cd /usr/local/src
tar -zvxf freetype-2.3.4.tar.gz
cd freetype-2.3.4
mkdir -p /usr/local/freetype
CFLAGS="-O3 -m32" CXXFLAGS="-O3 -m32"   ./configure --prefix=/usr/local/freetype
  
 
Zend 安装
tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
cd ZendOptimizer-3.3.3-linux-glibc23-i386
sh install.sh
中间有提示下一步 , 直到有个地方要指定 php.ini 路径
  输入之前 cp 的那个 php.ini 路径  
 
调试
启动 apache2
   修改 /usr/local/apache 2/conf/httpd.conf 文件
   ServerName *********:80    修改成自己的 lo 地址   ServerName 127.0.0.1:80
  /usr/local/apache2/bin/apachectl  start
想要系统开机自动启动请在    /etc/rc.local  加入上面这一行
在浏览器上输入 127.0.0.1 ;  显示    itworks!!!!  表示 apache2 启动成功
修改 apche 配置
vi conf/extra/httpd-mpm.conf  
<IfModule mpm_prefork_module>
    StartServers          20
    MinSpareServers      20
    MaxSpareServers      50
    MaxClients          800
    MaxRequestsPerChild   0
</IfModule>
培植 apache 主配置文件
vi/usr/local/apache2/conf/httpd.conf
 
   User nobody
 Group nobody
 ServerLimit 800
  <IfModule dir_module>
       DirectoryIndex index.html index.shtml index.php index.htm
  </IfModule>
AddType application/x-httpd-php .php
  # Various default settings
  Include conf/extra/httpd-default.conf
  # Virtual hosts
  Include conf/extra/httpd-vhosts.conf
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
----------------------------------------------------------
vi conf/extra/httpd-default.conf
   KeepAlive Off
  ServerTokens Prod
  ServerSignature Off
修改 zend
Vi    Zend/etc/php.ini( 这个是安装里面定义的 php.ini 路径 , 现在生成到这里 .)
 
expose_php = Off
max_execution_time = 60
max_input_time = 90
 
display_errors = Off
default_charset = "GBK"
upload_max_filesize = 4M
upload_tmp_dir= ..... <should check>
 
mysql.max_persistent = 100
mysql.max_links = 500
mysql.connect_timeout = 30
 
mbstring.language = GBK
mbstring.internal_encoding = GBK
mbstring.http_input = auto
mbstring.http_output = GBK
mbstring.encoding_translation = On
 
配置完在浏览器输入刚才的 test.php 地址
127.0.0.1/test.php
this is a test
到此结束啦
 
 

你可能感兴趣的:(apache,linux,PHP,SuSE,编译)