yum安裝必要工具(能解決比編譯遇到到基本問題):php
yum -y install gcc gcc-c++ make cmake automake autoconf kernel-devel ncurses-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel pcre-devel libtool-libs freetype-devel gd zlib-devel file bison patch mlocate flex diffutils readline-devel glibc-devel glib2-devel bzip2-devel gettext-devel libcap-devel libmcrypt-devel openldap openldap-devellibxslt-devel
configure: error: xml2-config not found. Please check your libxml2 installation.mysql
configure: error: Cannot find OpenSSL’s
yum install openssl-develconfigure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/
configure: error: libjpeg.(a|so) not found
configure: error: libpng.(a|so) not found.
yum install libpng-develconfigure: error: libXpm.(a|so) not found.
configure: error: freetype.h not found.
yum install freetype-devel
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
yum install libc-client-devel
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
yum install libmcrypt-devel
configure: error: Please reinstall libmhash – I cannot find mhash.h
yum install mhash-devel
configure: error: Cannot find MySQL header files under /usr.Note that the MySQL client library is not bundled anymore!
yum install mysql-devel
configure: error: Please reinstall ming distribution. libming.(a|so) not found- temp remove the config for ‘–with-ming=/opt/ming/’configure: error: Cannot find pspell
yum install pspell-devel
configure: error: cannot find mm libraryDownload from http://www.ossp.org/pkg/lib/mm/
wget ftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz
c++
tar -zxvf mm-1.4.2.tar.gz
sql
./configure
segmentfault
make
session
make installapp
configure: error: Cannot find libtidycurl
yum install libtidy-devel
socket
yum install libtidyide
change path at configure: ‘–with-tidy=/usr’configure: error: not found. Please reinstall the expat distribution.
yum install expat-devel
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
*Tips: To uninstall, just enter:yum remove {package-name}
轉載請註明:半葉寒羽
我是在CentOS6.5安裝php5.5.28這個版本,PHP編譯代碼以下:
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --with-fpm-user=php --with-fpm-group=php --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pear --with-gettext --enable-session --with-curl --enable-exif
安裝過程再也不贅述。由於在編譯安裝時沒有把mcrypt這個擴展編譯進去,因此在phpmyadmin裏有這樣一句提示:
缺乏 mcrypt 擴展。請檢查 PHP 配置。
另外在獨立安裝mycrypt擴展時,報錯:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
如今把mcrypt擴展安裝過程貼出來,但願對遇到此類問題的朋友有幫助:
1.首先編譯安裝 libmcrypt, mhash, mcrypt 二進制源碼包。
========================================
下載libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/related/libmcrypt
make
make install
=========================================
下載mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.9
cd mhash-0.9.9.9
./configrue --prefix=/usr/local/related/mhash
make
make install
=========================================
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
export LD_LIBRARY_PATH=/usr/local/related/libmcrypt/lib:/usr/local/related/mhash/lib
export LDFLAGS="-L/usr/local/related/mhash/lib -I/usr/local/related/mhash/include/"
export CFLAGS="-I/usr/local/related/mhash/include/"
./configure --prefix=/usr/local/related/mcrypt --with-libmcrypt-prefix=/usr/local/related/libmcrypt
make
make install
=========================================
cd /usr/local/src/develop/php-5.5.28/ext/mcrypt
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-mcrypt=/usr/local/related/libmcrypt
make
make install
生成的mcrypt.so文件已經被髮送到 /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so
由於我在php.ini設置extension_dir = /usr/local/php/extensions,
因此須要執行:
cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so /usr/local/php/extensions
而後在php.ini裏面添加:
extension=mcrypt.so
重啓php,執行: service php-fpm restart
運行phpinfo(),發現新增了mcrypt擴展項,並且phpmyadmin裏面關於mcrypt的提示也不見了。
在安裝過程當中走了彎路,一度鄙視這種編譯安裝方式,多虧了這位大神發的帖子幫忙。
詳見: http://segmentfault.com/q/1010000000094627