環境:CentOS 6.5
cd /usr/local/src
wget http://syslab.comsenz.com/downlo … -icc-glibc23.tar.gz
tar zxvf /usr/local/src/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz 解壓
mv mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql
useradd -s /sbin/nologin mysql
cd /usr/local/mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
./scripts/mysql_install_db –user=mysql –datadir=/data/mysql
cp support-files/my-large.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
vim /etc/init.d/mysqld #修改basedir=/usr/local/mysql datadir=/data/mysql
chkconfig –add mysqld
chkconfig mysqld on
service mysqld start
因為我之前已經在自己的虛擬機上安裝過apache了,這次安裝為第二次安裝。通常安裝apache第一次比較順利,再次安裝則可能出現各種各樣的問題。
==>安裝2.2版本的apache
cd /usr/local/src
wget http://syslab.comsenz.com/downloads/linux/httpd-2.2.16.tar.gz
tar zxvf httpd-2.2.16.tar.gz 解壓
cd httpd-2.2.16.tar.gz
./configure –prefix=/usr/local/apache2 –with-included-apr –with-pcre –enable-mods-shared=most 使用此命令進行編譯
apr支持apache在不同的平臺上使用
出現報錯:configure: error: Size of "void *" is less than size of "long"
百度中有說法:
增加 ap_cv_void_ptr_lt_long=no
移除–with-pcre=/xxx/xxx/pcre選項
./configure –prefix=/usr/local/apache2 –with-included-apr –with-pcre –enable-mods-shared=most ap_cv_void_ptr_lt_long=no 使用此命令進行編譯
結果顯示 config.status: executing default commands 好了,編譯問題解決
make也不順利,出現了一下信息的報錯提示
undefined reference to `pcre_info'
collect2: ld returned 1 exit status
make[1]: *** [httpd] 錯誤 1
make[1]: Leaving directory `/usr/local/src/httpd-2.2.16'
make: *** [all-recursive] 錯誤 1
查閱資料獲得,2.2版本的apache的安裝實際上是使用自身的apr,將安裝時系統已經存在的apr刪除后,在進行編譯應該就沒有問題了(猜測與我已經安裝過一次了有關系)
==>安裝2.4版本的apache
CentOS6中,之前使用yum安裝的apr已經不適用于httpd-2.4版本了,所以需要源碼編譯安裝apr和apr-util
cd /usr/local/src
wget http://mirrors.cnnic.cn/apache/apr/apr-1.5.1.tar.bz2
tar jxvf apr-1.5.1.tar.bz2
cd apr-1.5.1
./configure –prefix=/usr/local/apr
make
make install
cd /usr/local/src
wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.5.4.tar.gz
tar zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure –with-apr=/usr/local/apr/
make
make install
cd /usr/local/src
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.10.tar.bz2
./configure –prefix=/usr/local/apache2 –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util/
make
make install
wget http://cn2.php.net/distributions/php-5.3.28.tar.gz
tar zxf php-5.3.28.tar.gz
cd php-5.3.28
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-config-file-path=/usr/local/php/etc –with-mysql=/usr/local/mysql –with-libxml-dir –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –with-iconv-dir –with-zlib-dir –with-bz2 –with-openssl –with-mcrypt –enable-soap –enable-gd-native-ttf –enable-mbstring –enable-sockets –enable-exif –disable-ipv6
◆編譯時報錯:xml2-config not found. Please check your libxml2 installation.
提示此類信息一般缺少相關的庫,而相關庫一般是 *-devel 形式的,比如 libxml2-devel
解決:
[root@yue php-5.3.28]# rpm -qa |grep libxml2 <== 查看有沒有安裝libxml2
[root@yue php-5.3.28]# yum install -y libxml2 <== 安裝兩個包
[root@yue php-5.3.28]# yum install -y libxml2-devel
[root@yue php-5.3.28]# find / -name "xml2-config" <== find一下,發現系統里現在已經有libxml2
/usr/bin/xml2-config
重新編譯,出現錯誤提示:configure: error: Please reinstall the BZip2 distribution
按照上面的兩個思路安裝兩個包
[root@yue php-5.3.28]# yum install -y bzip2
[root@yue php-5.3.28]# yum install -y bzip2-devel
編譯又報錯:configure: error: jpeglib.h not found.
[root@yue php-5.3.28]# yum install -y libjpeg-devel <== 注意安裝的為libjpeg-devel
編譯又出現了報錯:configure: error: png.h not found.
[root@yue php-5.3.28]# yum install -y libpng-devel <== 注意安裝包的名稱
還有報錯:configure: error: freetype.h not found.
繼續安裝[root@yue php-5.3.28]# yum install -y freetype-devel
報錯又來:configure: error: mcrypt.h not found. Please reinstall libmcrypt.
我們先來查一下需要安裝哪些包
[root@yue php-5.3.28]# yum list|grep mcrypt
file:///mnt/repodata/repomd.xml: [Errno 14] Could not open/read file:///mnt/repodata/repomd.xml
Trying other mirror. <== 查看過程中出現這樣的提示
出現此問題的原因是系統中沒有安裝epel擴展源,yum 源安裝一下即可
[root@yue php-5.3.28]# yum list|grep mcrypt
file:///mnt/repodata/repomd.xml: [Errno 14] Could not open/read file:///mnt/repodata/repomd.xml
Trying other mirror.
libmcrypt.i686 2.5.8-9.el6 epel
libmcrypt-devel.i686 2.5.8-9.el6 epel
libtomcrypt.i686 1.17-21.el6 epel
libtomcrypt-devel.i686 1.17-21.el6 epel
libtomcrypt-doc.noarch 1.17-21.el6 epel
mcrypt.i686 2.6.8-10.el6 epel
php-mcrypt.i686 5.3.3-3.el6 epel 正常了
安裝[root@yue php-5.3.28]# yum install -y mcrypt-devel
!!編譯成功!! Thank you for using PHP.
◆make 如果看不出來是否成功,可以使用echo $?查看 0為成功 1為失敗
報錯:/usr/local/src/php-5.3.28/Zend/zend_language_parser.h:317: 錯誤:與‘zendparse’類型沖突
/usr/local/src/php-5.3.28/Zend/zend_globals_macros.h:35: 附注:‘zendparse’的上一個聲明在此
make: *** [ext/standard/basic_functions.lo] 錯誤 1
提示類型沖突,那我們就修改一下類型
打開上面的兩個文件,我們對應行數可以看到
在zend_language_parser.h:317
int zendparse (void);
在zend_globals_macros.h:35
int zendparse(void *compiler_globals);
錯誤就是參數不一致導致的:
我們vim一下,
把zend_language_parser.h:317的
int zendparse (void) ==> int zendparse(void *compiler_globals) 成功!!
◆make install