CentOS 5/6 64位下tarball安装PHP5.4步骤
安装EPEL仓库 https://fedoraproject.org/wiki/EPEL/FAQ#howtouse
for CentOS6: rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
for CentOS5: rpm -ivh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm删除已有php包
# yum remove php php-\*安装依赖包
# yum install 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 mcrypt \
mysql-devel libicu libicu-devel pcre-devel \
gpm gmp gmp-devel gcc gcc-c++ zlib zlib-devel glibc glibc-devel \
glib2 glib2-devel bzip2 bzip2-devel krb5 krb5-devel libxml2 libxml2-devel p7zip \
re2c bison bison-devel \
libevent libenent-devel \添加php进程属主
# useradd -M -s /bin/false www编译,安装
# ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu \
--with-layout=GNU --with-libdir=lib64 \
--prefix=/usr/local --exec-prefix=/usr/local \
--sysconfdir=/etc --libdir=/usr/local/lib64/php \
--sbindir=/usr/local/sbin --sharedstatedir=/usr/com --datadir=/usr/local/share \
--includedir=/usr/local/include --libexecdir=/usr/local/libexec \
--localstatedir=/var --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=shared --with-gmp=shared --with-iconv --with-jpeg-dir --with-png-dir \
--with-openssl --with-libxml-dir --with-pcre-regex \
--with-mcrypt=shared --with-zlib \
--with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-mysqli --with-pdo-mysql \
--with-pgsql=/usr/pgsql-9.1 --with-pdo-pgsql=/usr/pgsql-9.1 \
--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=shared \
--enable-pcntl \
--enable-intl --enable-mbstring \
--enable-zip --with-bz2=shared \
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
--without-unixODBC --enable-mbregex \
--enable-fpm --with-fpm-user=www --with-fpm-group=www \
--disable-tokenizer --disable-phar \
--without-sqlite3 --without-pdo-sqlite \# make && make install
如果没安装postgresql9.1则删除相关参数
安装有如下类似结果:
Installing shared extensions: /usr/local/lib64/php/20100525/ Installing PHP CLI binary: /usr/local/bin/ Installing PHP CLI man page: /usr/local/share/man/man1/ Installing PHP FPM binary: /usr/local/sbin/ Installing PHP FPM config: /etc/ Installing PHP FPM man page: /usr/local/share/man/man8/ Installing PHP FPM status page: /usr/local/share/fpm/ Installing PHP CGI binary: /usr/local/bin/ Installing build environment: /usr/local/lib64/php/build/ Installing header files: /usr/local/include/php/ Installing helper programs: /usr/local/bin/ program: phpize program: php-config Installing man pages: /usr/local/share/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/share/pear/ [PEAR] Archive_Tar - already installed: 1.3.7 [PEAR] Console_Getopt - already installed: 1.3.0 [PEAR] Structures_Graph- already installed: 1.0.4 [PEAR] XML_Util - already installed: 1.2.1 [PEAR] PEAR - already installed: 1.9.4 Wrote PEAR system config file at: /etc/pear.conf You may want to add: /usr/local/share/pear to your php.ini include_path Installing PDO headers: /usr/local/include/php/ext/pdo/