詳解 Qt 數(shù)據(jù)庫環(huán)境配置
本文介紹的是Qt 數(shù)據(jù)庫環(huán)境配置,環(huán)境配置:Qt 4.2.3 + ZendOptimizer + mbstring + mcrypt + GD庫 。
一、安裝RedHat Linux Array.0
安裝系統(tǒng)時請務必安裝開發(fā)工具包和KDE開發(fā)工具包,WWW服務器和SQL服務器不要安裝,否則可能會出現(xiàn)未知的錯誤。
二、確定linux系統(tǒng)是否安裝gcc編譯器
᥿Array;᥿Array;首先,服務器GCC要有,不然什么都不能做.可以用gcc -v來查看是否安裝了GCC,
- #gcc -v
- Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
- Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
- --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking
- --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
- Thread model: posix
- gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
有以上類似信息說明已有GCC,如果你沒有,請先拿安裝光盤裝好它。
三、請下載以下所有的東西
- httpd-2.2.4.tar.gz
- MySQL-client-5.0.37-0.i386.rpm
- MySQL-server-5.0.37-0.i386.rpm
- MySQL-devel-5.0.37-0.i386.rpm
- php-5.2.1.tar.gz
- ZendOptimizer-3.2.4-linux-glibc21-i386.tar.gz
- gd-2.0.28.tar.gz
- libxml2-2.6.11.tar.gz
- zlib-1.2.1.tar.gz
- jpegsrc.v6b.tar.gz
- libpng-1.2.5.tar.gz
- xpm-3.4k-2.i386.rpm
- gd-devel-1.8.4-11.i386.rpm
- libmcrypt-2.5.7.tar.gz
- qt-x11-opensource-src-4.2.3.tar.gz
可能你的電腦不需要這么多.但***都下載吧.不過,可能你看到這貼子的時候會有以上軟件新的版本下載了.看著辦吧.
開始裝吧>>>>>>>>>>>>>>>>>>>>>>>>>
推薦一個下載軟件包的網(wǎng)址:http://www.filewatcher.com/
四、安裝MYSQL 服務器
- #rpm -ivh MySQL-server-5.0.37-0.i386.rpm
- #rpm -ivh MySQL-client-5.0.16-0.i386.rpm
- #rpm -ivh MySQL-devel-5.0.16-0.i386.rpm(沒有它不能安裝php5.2.1)
安裝好后試試能不能用
- #mysql
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 27651 to server version: 4.0.20-standard
- Type ’help;’ or ’\h’ for help. Type ’\c’ to clear the buffer.
說明OK,請自己改mysql的密碼SET PASSWORD=PASSWORD(’密碼’);
五、安裝GD庫基本包
- #rpm -ivh gd-devel-1.8.4-11.i386.rpm
六、安裝XPM支持
- #rpm -ivh xpm-3.4k-2.i386.rpm
#p#
七、安裝libxml2 (記得PHP5.2.1只支持libxml2-2.6.11以上版本)
- #tar zxvf libxml2-2.6.11.tar.gz
- #cd libxml2-2.6.11
- #./configure
- #make
- #make install
八、裝GD庫支持
(1)安裝ZLIB
- #tar zxvf zlib-1.2.1.tar.gz
- #cd zlib-1.2.1
- #./configure
- #make
- #make install
- (2)安裝JPEGSRC
- #tar zxvf jpegsrc.v6b.tar.gz
- #cd jpegsrc-6b
- #./configure
- #make
- #make install-lib
- #make install
(3)安裝LIBPNG
- #tar zxvf libpng-1.2.5.tar.gz
- #cd libpng-1.2.5
- #cp scripts/makefile.std Makefile
- #make
- #make install
(4)***是安裝GD2.*
- gd-2.0.28
- #tar zxvf gd-2.0.28.tar.gz
- #cd gd-2.0.28
- #./configure --with-png=/usr/local --with-jpeg=/usr/local --with-freetype=/usr
- #make
- #make install
上面一切都很順利的話,GD就算成功的安裝上了. 如果有問題,應該是缺少支持包,總之是少什么就下載什么來安裝上.
九、安裝mcrypt
- #tar xzvf libmcrypt-2.5.7.tar.gz
- #cd libmcrypt-2.5.7
- #./configure
- #make
- #make install
十、安裝APAHCHE2
- #tar zxvf httpd-2.2.4.tar.gz
- #cd httpd-2.2.4
- #./configure --prefix=/usr/local/apache2 --enable-module=so
- #make
- #make install
#p#
十一、安裝PHP5
- #tar zxvf php-5.2.1.tar.gz
- #cd php-5.2.1
- #./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
- --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-gd=/usr/local --enable-trace-vars
- --with-zlib-dir=/usr/local --with-mysql=/var/lib/mysql --with-mcrypt=/usr/local --enable-mbstring
- #make
- #make install
我是把他們分別安裝在/usr/local/apache2 & PHP目錄下的所有的安裝工作做好了,接著我們來配置.
#p#
十二、Apache2配置
(1)復制PHP.INI文件到正確位置,在PHP解壓的目錄下運行
- #cp php.ini-dist /usr/local/php/lib/php.ini
(2)編輯apache配置文件httpd.conf
- #vi /usr/local/apache2/conf/httpd.conf
要改的有如下幾處:
一般都在
- #AddType application/x-tar .tgz
下加一行
- AddType application/x-httpd-php .php
還有找到
- DirectoryIndex index.html index.html.var
在后面加 index.php 讓它把index.php做為默認頁
再找
- #ServerName
把#去掉,后面的IP改成你的IP.
找到
- DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改為你存放網(wǎng)頁文件的路徑
比如我是放在/myweb目錄下,所以我以后上傳PHP文件就放在/myweb目錄下,然后用IP訪問,就能看到首頁了
差不多就這些了,至于apache2其它優(yōu)化,請看 http://www.phpv.net/ 里的apache配置那一分類.保存httpd.conf文件.
(3)啟動Apache2
- # /usr/local/apache2/bin/apachectl start
如果沒有出錯,寫一個測試頁放到你網(wǎng)頁目錄下, 我的就是上面所說的 /myweb
- #vi /home/easy/index.php
保存.試試在測試器里打IP進去就可以看到PHPINFO頁了
好了.如無意外.你現(xiàn)在可以放心在你的機器上運行PHP腳本連接mysql了.
#p#
十二、安裝ZendOptimizer-3.2.4加速PHP
- #tar zxvf ZendOptimizer-3.2.4-linux-glibc21-i386.tar.gz
- #cd ZendOptimizer-3.2.4-linux-glibc21-i386
- #./install.sh
一路默認下去應該就好了.再看看測試頁,看看末尾是不是這樣的?
- This program makes use of the Zend Scripting Language Engine:
- Zend Engine v1.3.0, Copyright (c) 1ArrayArray8-2004 Zend Technologies with Zend Extension Manager v1.0.3,
- Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v3.2.4, Copyright (c) 1ArrayArray8-2004, by Zend Technologies
十三、安裝phpMyAdmin
- #unzip -d . phpMyAdmin-2.10.0.2-all-languages-utf-8-only.zip
- #mv phpMyAdmin-2.10.0.2-all-languages-utf-8-only /usr/local/apache2/htdocs/phpMyAdmin
- #cd /usr/local/apache2/htdocs/phpMyAdmin
- #cp library/config.default.php config.inc.php
- #vi config.inc.php
找到cfg[’PmaAbsoluteUri’]等號后面改為’http://localhost/phpMyAdmin’
找到cfg[’blowfish_secrect]等號后面改為’MySQL數(shù)據(jù)庫root用戶密碼’
找到cfg[’Server’][$i][’auth_type’]等號后面改為’cookie’
找到$cfg[’Servers’][$i][’user’]等號后面改為’root’
找到cfg[’Server’][$i][’password’]等號后面改為’MySQL數(shù)據(jù)庫root用戶密碼’
找到$cfg[’DefaultLang’]等號后面改為 zh-gb2312
找到$cfg[’DefaultCharset’]等號后面改為 gb2312
測試:
在瀏覽器中輸入 http://localhost/phpMyAdmin 輸入密碼后看看末尾mcrypt和mbstring擴展有沒有加載,如果沒有加載會有紅色警告提示
十四、安裝Qt4.2.3
- #tar xzvf qt-x11-opensource-src-4.2.3.tar.gz
- #cd qt-x11-opensource-src
- #./configure --qt-sql-mysql --qt-sql-sqlite --plugin-sql-mysql --plugin-sql-sqlite -I/usr/include/mysql -L/usr/lib/mysql
- #gmake
- #make install
- #echo "export PATH=/usr/local/Trolltech/Qt-4.2.3/bin:$PATH" >> ~/.bashrc
小結(jié):Qt數(shù)據(jù)庫環(huán)境配置的內(nèi)容介紹完了,希望本篇對你有幫助,想要更多內(nèi)容,請參考編輯推薦。