在centos上安装php5

php5 install on centos:

  • yum install -y httpd-devel libtool-ltdl libtool-ltdl-devel openssl-devel curl-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libc-client libc-client-devel  gd gd-devel libmcrypt libmcrypt-devel sqlite sqlite-devel mysql-devel libicu libicu-devel pcre-devel postgresql84 postgresql84-libs postgresql84-server postgresql84-devel
  • yum install -y mhash-devel
  • 如果不安装 libtool-ltdl-devel编译时会出错,所以要么安装这个包要么执行以下命令:
    • # cd /usr/lib
    • # ln -s libltdl.so.3.1.4 libltdl.so
    • libicu是 –enable-intl           Enable internationalization support 需要的包
  • ln -sv /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so
  • wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
  • gzip -cd ../php-5.2.17-fpm-0.5.14.diff.gz | patch -p1
  • PHP_HOME=/opt/php
  • configure
    • ./configure –with-apxs2=/usr/sbin/apxs \
    • –prefix=/usr/local –exec-prefix=/usr/local –with-exec-dir=/usr/local/bin \
    • –sysconfdir=/etc  –libdir=/usr/local/lib/php –with-libdir=lib \
    • –sbindir=/usr/local/sbin –sharedstatedir=/usr/com –datadir=/usr/local/share \
    • –includedir=/usr/local/include –libexecdir=/usr/local/libexec \
    • –localstatedir=/var –cache-file=../config.cache \
    • –mandir=/usr/local/share/man –infodir=/usr/local/share/info \
    • –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d \
    • –with-pic  –with-curl=shared  –with-freetype-dir –with-png-dir  \
    • –with-gettext –with-gmp –with-iconv –with-jpeg-dir –with-png-dir \
    • –with-openssl –with-layout=GNU –with-libxml-dir \
    • –with-pcre-regex=/usr \
    • –with-mcrypt=shared –with-mhash –with-zlib –with-bz2=shared \
    • –with-pdo-mysql –with-mysql –with-mysql-sock=/var/lib/mysql/mysql.sock \
    • –with-pgsql –with-pdo-pgsql –with-sqlite=shared –with-pdo-sqlite=shared \
    • –enable-sqlite-utf8 –with-kerberos –with-imap –with-imap-ssl \
    • –with-pear –with-gd –enable-gd-native-ttf –enable-calendar=shared \
    • –enable-exif –enable-ftp –enable-sockets –enable-bcmath \
    • –enable-sysvsem –enable-sysvshm –enable-sysvmsg –enable-intl \
    • –enable-mbstring –enable-zend-multibyte –enable-zip \
    • –without-unixODBC –disable-tokenizer –enable-fastcgi –enable-fpm \
    • –enable-discard-path –enable-safe-mode –enable-force-cgi-redirect
  • ./configure –prefix=/opt/php –with-config-file-path=/opt/php/etc –enable-fastcgi –enable-fpm –with-mcrypt –with-zlib –enable-mbstring –with-mysql –with-pdo-mysql –disable-debug –with-pic –disable-rpath –enable-inline-optimization –with-bz2 –with-libxml-dir –with-zlib –enable-sockets –enable-mbregex –with-mhash –with-xsl –enable-zip –with-pcre-regex
  • ./configure –prefix=$PHP_HOME –with-config-file-path=$PHP_HOME/etc –enable-fastcgi –enable-fpm –with-mcrypt –with-zlib –enable-mbstring –with-mysql –with-pdo-mysql –disable-debug –with-pic –enable-inline-optimization –with-bz2 –with-libxml-dir –with-zlib –enable-sockets –enable-mbregex –with-mhash –with-xsl –enable-zip –with-pcre-regex –with-curl=shared –with-config-file-scan-dir=$PHP_HOME/etc/php.d
  • ./configure –prefix=$PHP_HOME –with-config-file-path=$PHP_HOME/etc –enable-fastcgi –enable-fpm –with-mcrypt –with-zlib –enable-mbstring –with-mysql –with-pdo-mysql –disable-debug –with-pic –enable-inline-optimization –with-bz2 –with-libxml-dir –with-zlib –enable-sockets –enable-mbregex –with-mhash –with-xsl –enable-zip –with-pcre-regex –with-curl=shared –with-config-file-scan-dir=$PHP_HOME/etc/php.d  –with-gd –enable-gd-native-ttf

发表评论