GCC编译环境的安装:

      yum -y install gcc 

      yum -y install gcc-c++

 

 

预防万一,先执行:

yum install  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel m4.i386

 

1. ncurses GD库用

tar zxvf ncurses-5.6.tar.gz

cd ncurses-5.6
./configure --prefix=/usr --with-shared --without-debug
make

make install

cd ..

 

2. 安装 libxml2
tar xzvf libxml2-2.6.30.tar.gz 
cd libxml2-2.6.30
./configure --prefix=/usr/local/libxml2
make
make install
cp xml2-config /usr/bin

cd ..

 

3. 安装 libmcrypt

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


cd libltdl/
./configure  --enable-ltdl-install         
make
make install

cd ../..
  
  

4. 安装zlib2

tar zxvf zlib-1.2.3.tar.gz 
cd zlib-1.2.3
 ./configure --prefix=/usr/local/zlib
make
make install

cd ..

 

5. 安装PNG
tar zxvf libpng-1.2.34.tar.gz 
cd libpng-1.2.34
./configure --prefix=/usr/local/libpng
make
make install

cd ..

 

6. 安装JPEG6
cd /usr/local/
mkdir jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1

cd /usr/local/src

 

tar zxvf jpegsrc.v6b.tar.gz 
cd jpeg-6b/
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install

cd ..

 

7. 安装ttf ( ttf 是字体的支持 )
tar xzvf freetype-2.3.5.tar.gz 
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype
make
make install

cd ..
  
  8. autoconf

tar zxvf autoconf-2.61.tar.gz 
cd autoconf-2.61
./configure
make
make install

cd ..

 

 

9 选安 Fontconfig

tar -zxvf fontconfig-2.4.2.tar.gz
cd fontconfig-2.4.2

export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH

./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config

这里显示一个错误信息:
checking for LIBXML2... configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:

No package 'libxml-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBXML2_CFLAGS
and LIBXML2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

但是我们在上面其实已经安装上 libxml2 了的,这里只是一个 环境变量没有设置好而已。

解决办法: 确定 /usr/local/libxml2/lib/pkgconfig 目录下有 libxml-2.0.pc

export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH

再次生成 makefile , 这样就成功了

./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config
好了吧,没有出现那个错误了。

make
make install

 

10 GD库

tar zxvf gd-2.0.35.tar.gz 
cd gd-2.0.35
./configure --prefix=/usr/local/gd2/ --with-zlib=/usr/local/zlib/ --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype/  --with-fontconfig=/usr/local/fontconfig 
 

可选 --with-fontconfig=/usr/local/fontconfig 配合9

 

看到下面的信息, 呵呵  很多都显示支持了
   Support for PNG library:          yes
   Support for JPEG library:         yes
   Support for Freetype 2.x library: yes
   Support for Fontconfig library:   yes
   Support for Xpm library:          no
   Support for pthreads:             yes


make
make install

 

 

11 支持MSSQL
tar zxvf freetds-0.82.tar.gz 

cd freetds-0.82/
./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib
make 
make install

 

 (httpd-2.4.3的安装参见: http://norman20000.blog.51cto.com/2707146/997799)

tar xvjf httpd-2.2.15.tar.bz2 
cd httpd-2.2.15
./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd --with-z=/usr/local/zlib --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
make
make install


修改:
<Directory />
    Options FollowSymLinks
    AllowOverride None
    #Order deny,allow  屏蔽
    #Deny from all   屏蔽
</Directory>

放开
# Virtual hosts
Include /etc/httpd/extra/httpd-vhosts.conf

修改并添加:
<VirtualHost 192.168.0.3:80>
    DocumentRoot "/home/admin/web"
    #ServerName web.com
    #ServerAlias www.web.com
    DirectoryIndex index.html index.php index.htm
    ErrorLog "logs/web-error_log"
    CustomLog "logs/dummy-web-access_log" common
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/usr/local/apache2/htdocs"
    ServerName *
</VirtualHost>

 

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

编辑完成后,保存退出,执行下列命令:

chmod +x /etc/rc.d/init.d/httpd    #为此服务脚本赋予执行权限 

chkconfig -&ndash;add httpd               #将其加入到服务列表

-------------------------------------------------------------

[如果出现 service httpd does not support chkconfig ,的情况..

vi /etc/rc.d/init.d/httpd  中 加入

# chkconfig: 2345 10 90

# description: Activates/Deactivates Apache Web Server   ]

-------------------------------------------------------------

chkconfig httpd on                 #设置为开机启动

service httpd configtest            #对httpd的配置文件进行检查

【如果出现 Set the 'ServerName' directive globally to suppress this message .

vi /etc/httpd/httpd.conf  将 ServiceName 修改成 localhost:80 】

service httpd start                 #启动httpd服务


  
yum list
yum list | grep ncur
yum install ncurses-devel.i386
yum install php-ncurses.i386  

 

MYSQL编译安装

 

1.增加用户
groupadd mysql
useradd -g mysql mysql

 

2.解压

tar zxvf mysql-5.0.81.tar.gz 

 

3.配置环境
cd mysql-5.0.81
./configure --prefix=/usr/local/mysql --with-extra-charsets=all

 

4.

make

 

5.

make install

 

6. 配置文件

cp support-files/my-medium.cnf /etc/my.cnf

 

7.初始化
cd /usr/local/mysql/
cd bin
./mysql_install_db --user=mysql

 

8.改所有权

cd /usr/local/mysql
chown -R root .
chown -R mysql var/
chgrp -R mysql .

 

9.启动

/usr/local/mysql/bin/mysqld_safe --user=mysql &
netstat -tnl

cd bin

 

10.测试

./mysqladmin version
./mysqladmin variables

 

11.访问权限

bin/mysql -u root
mysql> delete from mysql.user where host='localhost' and user='';

mysql>FLUSH PRIVILEGES;
mysql>set password FOR 'root'@'localhost'=PASSWORD('123456'); 

 

12.自动开机

cd /root/mysql-5.0.81
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 3 mysqld on

chkconfig --list mysqld

 

PHP安装编译

 


cd /usr/local/src/

tar zxvf php-5.2.17.tar.gz
cd php-5.2.17

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/libxml2/ --with-png-dir=/usr/local/libpng/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-zlib-dir=/usr/local/zlib/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --with-mssql=/usr/local/freetds/   
make
make install

cp php.ini-dist /usr/local/php/etc/php.ini
/usr/local/apache2/bin/apachectl restart

 

vi /etc/httpd/httpd.conf的

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
下面加上
AddType application/x-httpd-php .php .phtml

 

然后重启httpd


 问题

1.
编译Mysql时configure: error: No curses/termcap library found 的错误解决方法
  
安装ncurses


2.
configure: error: build test failed.  Please check the config.log for details.

yum install libxml
yum install libxml-devel
yum install libxml2
yum install libxml2-devel


3.
Configuring extensions
checking whether to enable LIBXML support... yes
checking libxml2 install dir... yes
checking for xml2-config path... /usr/local/bin/xml2-config
checking whether libxml build works... no
configure: error: build test failed.  Please check the config.log for details.

--with-libxml-dir=/usr/local/libxml2/
更改为
--with-libxml-dir=/usr/lib

就可以了,也就是把PHP的安装路径给改变.也许是权限的问题。有些扩展包我是采用CENTOS 5自带的。只是加上DEVEL,这样子。加安装路径时可以用=/usr/lib参数。
/usr/local/libxml2/lib/libxml2.so.2.6.30  安装的时候,没有安装到 /usr/lib目录里
/usr/lib/libxml2.so.2.6.26

ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2


4.
locate libltdl.so 
ln -s /usr/local/lib/libltdl.so.3 /usr/lib/libltdl.so.3

 

5.

gd_png.c:747: error: expected ')' before 'gdMalloc'
gd_png.c:804: error: expected ')' before 'gdMalloc'

 

vi gd_png.c

#include &ldquo;png.h&rdquo;             
替换成:
#include &ldquo;/usr/local/libpng/include/png.h&rdquo;             
然后再make就可以了

 

6.

Cannot load /usr/local/apache2/modules/libphp5.so into server: libltdl.so.3: cannot open shared object file: No such file or directory

yum install libtool-ltdl

 

7.

[root@wofang ~]# tsql -S 192.168.16.101 -U sa
locale is "en_US.UTF-8"
locale charset is "UTF-8"
Password: 

 

查看phpinfo()

GD SupportenabledGD Version2.0 or higherFreeType SupportenabledFreeType Linkagewith freetypeFreeType Version2.3.5GIF Read SupportenabledGIF Create SupportenabledJPG SupportenabledPNG SupportenabledWBMP SupportenabledZLib SupportenabledStream Wrapper supportcompress.zlib://Stream Filter supportzlib.inflate, zlib.deflateCompiled Version1.2.3Linked Version1.2.3libXML supportactivelibXML Version2.6.31libXML streamsenabled

看到了吧 , 支持东西挺多了, gif jpg png wbmp  freetype gd

---------
这是 mysql6 的支持

Active Persistent Links0Active Links0Client API version6.0.4-alphaMYSQL_MODULE_TYPEexternalMYSQL_SOCKET/tmp/mysql.sockMYSQL_INCLUDE-I/usr/local/include/mysqlMYSQL_LIBS-L/usr/local/lib/mysql -lmysqlclient

 

参考链接:

http://cch1988922.blog.51cto.com/865508/410719

http://blog.csdn.net/gunnerjason/article/details/6168306

http://guojing19901229.blog.163.com/blog/static/16674068320115443447681/

 

常见问题:

http://hi.baidu.com/wang01ning/blog/item/6076e2ee2f3be4e3cf1b3e16.html

http://chlotte.blog.51cto.com/318402/458342