apache+mysql+php+gd+freetds

 

1.       apache安装:
#yum –y install *gcc*       //安装gcc环境
#tar –zxvf http-*.tar.gz
#cd http-*
#./configure –prefix=/usr/local/apache2 –enable-so –enable-rewrite
#make && make install
设置开机自动启动
从/usr/local/apache/bin/apachectl 到 /etc/rc.d/init.d/httpd 建立一个符号连接:
# ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
然后在此文件总添加以下几行(大概在文件顶部,约第二行的地方):
# chkconfig: 2345 10 90
# description: Activates/Deactivates Apache Web Server
最后,运行chkconfig把Apache添加到系统的启动服务组里面:
# /sbin/chkconfig --del httpd
# /sbin/chkconfig --add httpd
编辑/etc/rc.d/rc.local
把/usr/local/apache2/bin/apachectl start 加入进去
 
2.       mysq安装:
#tar –zxvf mysql-*.tar.gz
#cd msyql-*
#useradd –M –s /sbin/nologin mysql       
#yum –y install libtermcap-devel
#./configure –prefix=/usr/local/mysql –with-mysqlduser=mysql
#make
#make install
#cp support-files/my-memdium.cnf /etc/my.cnf
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# chown -R root:mysql /usr/local/mysql/
#chown –R mysql /usr/local/mysql/var/
#echo “/usr/local/mysql/lib/mysql” >>/etc/ld.so.conf
#ldconfig
#/usr/local/mysql/bin/mysqld_safe –user=mysql &  //启动mysql
开机启动
#cd mysql-*
# cp support-files/mysql.server /etc/init.d/mysqld
#chmod +x /etc/init.d/mysqld
#chkconfig –add mysqld
#chkconfig mysql on
# export PATH=$PATH:/usr/local/mysql/bin/
# echo "PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile
 
3.       gd安装:
安装ZLIB2
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure –prefix=/usr/local/zlib

#################################################
不要用--prefix自定义安装目录,否则可能会影响后面安装,可能出现的错误:
configure: error: zlib not installed
#################################################
#################################################
如果你的机器是64位,并且在安装png时候出现下面错误:
/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

修补办法(接上面步骤):
vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
接下面步骤
#################################################
make
make install
安装JPEG6

#################################################
先建立目录,否则可能会出现类型下面错误:
/usr/bin/install -c cjpeg /usr/local/ /jpeg6
/usr/bin/install: cannot create regular file `/usr/local /jpeg6/bin/cjpeg’: No such file or directory
make: *** [install] Error 1

解决办法:
mkdir /usr/local /jpeg6
mkdir /usr/local /jpeg6/bin
mkdir /usr/local /jpeg6/lib
mkdir /usr/local /jpeg6/include
mkdir /usr/local /jpeg6/man
mkdir /usr/local/ jpeg6/man/man1
#################################################
cd /home/biaoest
tar -zxvf jpegsrc.v6b.tar.gz
cd jpegsrc.v6b.
./configure --prefix=/usr/local/ jpeg6

 
#################################################
如果你的机器是64位,并且在安装gd时候出现下面错误:
/usr/bin/ld: /usr/local/jpeg6/lib/libjpeg.a(compress.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/local/jpeg6/lib/libjpeg.a: could not read symbols: Bad value
 
 
collect2: ld returned 1 exit status
make[2]: *** [libgd.la] Error 1

修补办法(接上面步骤):
vi Makefile
找到 CFLAGS= -O2 -I$(srcdir)
在后面加入-fPIC,即变成CFLAGS= -O2 -I$(srcdir) -fPIC
接下面步骤
#################################################
make
make install-lib

#################################################
特别注意,要不下面会出现错误:
configure: error: libjpeg.(a|so) not found.
#################################################

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

################################################
如果出现下面错误:
configure: error: zlib not installed
请回到zlib,重新安装一次,最佳先 make clean
################################################
make install

安装freetype
tar -zxvf freetype-2.2.1.tar.gz
cd freetype-2.2.1
./configure --prefix=/usr/local/freetype
make
make install
安装GD
tar -zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure--prefix=/usr/local/gd
--with-jpeg=/usr/local/jpeg6/
--with-png=/usr/local/libpng/
--with-zlib=/usr/local/zlib
--with-freetype=/usr/local/ freetype/
make
#################################################
如果出现下面错误:

gd_png.c:825: warning: data definition has no type or storage class
make[2]: *** [gd_png.lo] Error 1
修复方法:
找到CPPFLAGS=-I/usr/local /freetype/include/freetype2 -I/usr/local/apache2/modlib/freetyp
e/include -I/usr/local/ /freetype/include -I/usr/local /jpeg6/include
原来是少了png的支持了,把他改为
CPPFLAGS=-I/usr/local /freetype/include/freetype2-I/usr/local /freetyp
e/include -I/usr/local/libpng /include -I/usr/local /jpeg6/include
#################################################

make install
安装LIBXML2
tar -zxvf libxml2-2.6.26.tar.gz
cd libxml2-2.6.26
./configure --prefix=/usr/local/xml2
make
make install
安装freetds
#tar –zxvf freetds-*.tar.gz
#cd freetds-*
#./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib  --enable-static
#make && makeinstall
 
 
4.       php安装
#tar –zxvf php-*.tar.gz
#cd php-*
#./configure
--prefix=/usr/local/php
--with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/local/mysql
--with-libxml-dir=/usr/local/xml2
--with-png-dir=/usr/local/libpnng
--with-jpeg-dir=/usr/local/jpeg6
--with-zlib
--with-freetype-dir=/usr/local/freetype
--enable-pdo
--with-pdo-sqlite
--with-pdo-mysql=/usr/local/mysql/bin/mysql_config
--with-pdo-dblib=/usr/local/freetds/
--with-gd=/usr/local/gd
--with-curl
--with-mssql=/usr/local/freetds/
--disable-debug
--enable-sockets
--enable-force-cgi-redirect
--enable-calendar
--enable-magic-quotes
--enable-ftp
--enable-gd-native-ttf
 --with-ttf --with-gdbm
--with-iconv --enable-mbstring=all
报错1

checking if we should use cURL for url streams... no
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
  easy.h should be in <curl-dir>/include/curl/
 

 需要安装:yum -y install curl*
报错2

checking for strftime... (cached) yes
checking for QDBM support... no
configure: error: DBA: Could not find necessary header file(s).

需要安装:yum -y install php-dba.i386 php-dbase.i386 gdbm-devel
报错3

checking for MSSQL support via FreeTDS... yes
configure: error: Directory /usr/local/freetds/ is not a FreeTDS installation directory

解决办法:
就是php找不到freetds的安装路径
其实是
PHP检测其安装目录的时候有些问题,检查依据是两个已经不用的文件,创建两个空文件就OK
touch /usr/local/freetds/include/tds.h
touch /usr/local/freetds/lib/libtds.a
报错4

checking lex output file root... ./configure: line 3246: lex: command not found
configure: error: cannot find output from lex; giving up

修补方法,安装FLEX:
rpm -Uvh flex-2.5.4a-33.x86_64.rpm
报错5

configure: error: libjpeg.(a|so) not found.

修补方法:
原来在安装jpeg的时候,执行了make install,应该执行make install-lib才能生成libjpeg.a文件
#make
#make install
#cp php.ini-dict /usr/local/php/lib/php.ini
#vim /usr/local/apache2/conf/httpd.conf

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

//红色的字是增加的
 
5.       测试php
#vim /usr/local/apache2/htdocs/index.php

<?php
        phpinfo();
?>

#serveric apache stop
#serveric apache start

你可能感兴趣的:(apache,linux,PHP,mysql,FreeTDS)