apache2.2+PHP5.2.3+mysql5.0+gd+zend+phpmyadmin
apache2.2+PHP5.2.3+mysql5.0+gd+zend+phpmyadmin
以前自己編譯了lamp,然後直接拷貝到/usr/local目錄下,直接可以執行,可是問題出現了。論壇的驗證碼有問題,原來是彩色的現在變成黑白了,不能輸入驗證碼,後來查詢了網際網路原因是到php.ini開啟gd庫前面的分號去掉,重啟apache還是不行。沒辦法就重新編譯了lamp加上gd的支援。首先安裝上所需的開發包
yum install -y 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 openssl-devel libxml2-devel gettext-devel pcre-devel
在另外一臺機器上編譯,然後移植到本機上。下面只是做個記錄以免以後忘記,一些基本的步驟。
1.編譯mysql
./configure –prefix=/usr/local/mysql –with-extra-charsets=gbk//配置支援gbk型別
make && make install
cp support-files/my-medium.cnf /etc/my.cnf //拷貝mysql安裝目錄中的配置檔案
groupadd mysql//新增mysql組
useradd mysql -g mysql//把mysql使用者加入mysql組中
chown -R mysql.mysql /usr/local/mysql//把mysql目錄主和組都修改為mysql
mysql_install_db –user=mysql//初始化資料庫
chown -R root /usr/local/mysql/bin//把bin目錄主為root
chown -R mysql /usr/local/mysql/var// 把var主位mysql
mysqld_safe –user=mysql& //啟動資料庫
cp share/mysql/mysql.server /etc/init.d/mysqld //拷貝安裝目錄中的mysql.server到/etc/init.d中
chkconfig –add mysqld//新增mysqld服務
chkconfig –level 345 mysqld on //讓runlevel 345啟動mysqld服務
netstat -lntp|grep mysql//檢視mysql
ln -s /usr/local/mysql/bin/mysql /sbin/mysql//建立軟連結mysql
ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin//建立符號連結mysqladmin
mysqladmin -uroot password `123456`//修改資料庫密碼
mysql -u root mysql -p123456//進入mysql資料庫密碼為123456
2.編譯apache
./configure –prefix=/usr/local/apache –enable-rewrite –enable-proxy –enable-cache –enable-disk-cache –enable-mem-cache –enable-deflate –enable-expires –enable-headers –enable-so –enable-proxy-balancer –enable-proxy-http –with-mem=worker
make && make install
/usr/local/www/bin/apachectl start //啟動apache
echo “/usr/local/www/bin/apachectl start” >> /etc/rc.local //隨機啟動
3.PHP GD 和gettext 的安裝
安裝gd:
./configure –prefix=/usr/local/gd
make && make install
安裝gettext
./configure –prefix=/usr/local/gettext
make && make install
安裝php
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-mysql=/usr/local/mysql –with-gd=/usr/local/gd/ –with-zlib-dir –with-gettext=/usr/local/gettext/ –with-png-dir –with-jpeg-dir –with-freetype-dir –enable-mbstring=all –with-curl-with
make && make install
cp php.ini-dist /usr/local/php/lib/php.ini//拷貝php安裝目錄php.ini.dist到/usr/local/php/lib/php.ini順便改名。
4.安裝Zend
Zend的作用的是加速php頁面的速度
./install.sh
安裝過程中最好不要重啟apache Zend會自動重啟
5.拷貝phpmyadmin到/usr/local/apache/htdocs中
6.配置httpd.conf檔案
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php //新增index.php索引
<IfModule mime_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
7.php.ini //把前面的分號去掉就可以啟動。
extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_oci8.dll
8.編譯好之後直接打包/usr/local目錄下的五個包,然後拷貝/etc/my.cnf等檔案,以下是打包好的檔案。
安裝步驟如下:
拷貝apache gd gettext mysql php幾個目錄到/usr/local目錄下,cp -rf my.cnf /etc目錄下。
/usr/local/apache/bin/apachectl start //啟動httpd程式
如果出現缺少libXpm.so.4 的庫檔案直接把libXpm.so.4拷貝到/usr/lib目錄下,如果許可權問題請關閉selinux
cp -rf libXpm.so.4 /usr/lib目錄下,然後ln -s /usr/lib/libXpm.so.4 libXpm.so.4.11.0
/usr/local/mysql/libexec/mysqld –user=root& //啟動mysqld
echo “/usr/local/mysql/libexec/mysqld –user=root&”>>/etc/rc.local//設定開機啟動mysql
echo /usr/local/apache/bin/apachectl start>>/etc/rc.local//設定開機啟動apache
網站根目錄為/usr/local/apache/htdocs裡面phpinfo.php可以測試一下http://ip/phpinfo.php即可。
phpmyadmin 在/usr/local/apache/htdocs目錄下可以用http://ip/phpmyadmin測試一下root 密碼為123456
資料庫/usr/local/mysql/bin/mysql -u root -p123456密碼為123456
9.本人為了方便所以寫了一個指令碼其實也不算什麼指令碼呵呵!
#!/bin/bash
cp -rf apache gd gettext mysql php /usr/local
cp -rf my.conf /etc
cp -rf libXpm.so.4.11.0 /usr/lib
ln -s /usr/lib/libXpm.so.4.11.0 /usr/lib/libXpm.so.4
echo “/usr/local/mysql/libexec/mysqld –user=root&” >> /etc/rc.local
echo /usr/local/apache/bin/apachectl start >> /etc/rc.local
/usr/local/apache/bin/apachectl start
/usr/local/mysql/libexec/mysqld –user=root&
安裝直接執行chmod 777 install
./install即可。
最後在/usr/local/apache/htdocs建立一個phpinfo.php,檢視一下是否支援gd
vi /usr/local/apache/htdocs/phpinfo.php
<?php
phpinfo();
?>
然後http://ip/phpinfo.php 看到以下資訊說明已經支援gd了。
到最後終於好了。
本文轉自zh888 51CTO部落格,原文連結:http://blog.51cto.com/zh888/646420,如需轉載請自行聯絡原作者