# yum install relative package
$ yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel
#(1) GD2
$ cd /usr/local/src
$ wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
$ tar xzvf gd-2.0.33.tar.gz
$ cd gd-2.0.33
$ ./configure –prefix=/usr/local/gd2 –mandir=/usr/share/man //./configure 配置。
$ make //make 是用來編譯的,它從Makefile 中讀取指令,然後編譯。
$ make install //make install 是用來安裝的,它也從Makefile 中讀取指令,安裝到指定的位置。
#(2) Apache 日誌截斷程序
$ cd /usr/local/src
$ wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
$ tar xzvf cronolog-1.6.2.tar.gz
$ cd cronolog-1.6.2
$ ./configure –prefix=/usr/local/cronolog
$ make
$ make install
#(3) libxml 庫程序
$ cd /usr/local/src
$ wget http://ftp.gnome.org/pub/gnome/sources/libxml2/2.6/libxml2-2.6.26.tar.gz
$ tar zxvf libxml2-2.6.26.tar.gz
$ cd libxml2-2.6.26
$ ./configure –prefix=/usr/local/libxml2
$ make
$ make install
$ groupadd mysql
$ useradd -g mysql mysql
$ gunzip < mysql-VERSION.tar.gz | tar -xvf -
$ cd mysql-VERSION
$ ./configure --prefix=/usr/local/mysql
$ make
$ make install
$
$ cp support-files/my-medium.cnf /etc/my.cnf
$ cd /usr/local/mysql
$ chown -R mysql .
$ chgrp -R mysql .
$ bin/mysql_install_db --user=mysql
$ chown -R root .
$ chown -R mysql var
$ bin/mysqld_safe --user=mysql &
4、編譯安裝Apache2.24
這個最簡單了,基本不會有錯誤發生。
$ yum -y install openssl openssl-devel
# tar zxvf httpd-2.2.17.tar.gz
# cd httpd-2.2.17
$ ./configure --prefix=/opt/httpd-2.2.17 --enable-modules=all --enable-mods-shared=all --enable-proxy --enable-ssl --enable-so --with-mpm=prefork --with-pcre
$ make -j8
$ make install
$ ln -s /opt/httpd-2.2.17 /opt/httpd
$ echo '
# Start Apache
/usr/local/apache2/bin/apachectl start' >> /etc/rc.local
編譯安裝curl
下載curl 安裝到/usr/local/curl
5、編譯安裝php5.3.3
./configure --prefix=/usr/local/php --with-apxs2=/opt/httpd/bin/apxs --with-config-file-path=/usr/local/php --with-openssl --enable-bcmath --enable-calendar --with-curl=/usr/local/curl --with-curlwrappers --enable-ftp --with-gd --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr --enable-gd-native-ttf --with-gettext --enable-mbstring --enable-exif --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-xmlrpc --enable-soap --enable-sockets --enable-zip
$ make
$ make install
$ cp php.ini-recommended /etc/php.ini
$ yum -y install php-devel
1、安裝配置freetds
下載地址: http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
用以Linux和Unix連接MS SQLServer和Sybase數據庫。
$ wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
$ tar zxvf freetds-stable.tgz
$ cd freetds-stable
$ ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib
$ make && make install
$ cd /usr/local/src/php-5.3.3/ext/pdo_dblib
$ phpize
$ ./configure --with-php-config=/usr/local/php/bin/php-config --with-mssql=/usr/local/freetds --enable-pdo --with-pdo-dblib=/usr /local/freetds
如configure出現下列錯誤請按如下方法解決
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
修改php.ini文件,添加行
extension=pdo_dblib.so
$ cp /usr/local/php-5.3.3/src/ext/pdo_dblib/modules/pdo_dblib.so /usr/lib/php/modules/.
$ /opt/httpd/bin/httpd -k restart
6、整合apache 與php
# vi /opt/httpd/conf/httpd.conf
在最後一行加上:
AddType application/x-httpd-php .php
查找:(設置WEB 默認文件)
DirectoryIndex index.html
替換為:
DirectoryIndex index.php index.html index.htm //在WEB 目錄不到默認文件,httpd 就會執行/var/www/error/noindex.html
Q & A:
Q:
I have the following very simple script that uses PDO/FreeTDS to connect
to a mssql server. I have PHP Version 5.3.3 running on Linux under
Apache. When I view this script via apache/firefox I get proper output.
If I try and run this via the command line, I get
an error connecting to the DB:
SQLSTATE[HY000] Unable to connect: Adaptive
Server is unavailable or does not exist (severity 9).
A:
This is because php-cli is parsing different php.ini.
Please solved this problem as below:
1)Checking the output of phpinfo() of php.ini by execute
$ php -i | grep php.ini
you will get the information of /path_difference/to/php_ini_root/php.ini.
$ cd /path_difference/to/php_ini_root && ln -s /path/to/real/php.ini php.ini
沒有留言:
張貼留言