php編譯安裝

1、準備安裝php

yum -y install gcc gcc-c++ gcc-g77 libmcrypt libmcrypt-devel php-mcrypt 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 mysql-devel net-snmp-devel curl-devel perl-DBI mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc  php-bcmath php-mbstringmysql

2、如今phpnginx

wget http://cn2.php.net/distributions/php-5.5.31.tar.gzc++

tar zxvf php-5.5.31.tar.gzsql

cd php-5.5.31.tar.gz性能優化

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl  --with-zlib --enable-zip --with-bz2oracle

詳解curl

./configure \socket

--prefix=/usr/local/php \                                    #php安裝目錄函數

--with-config-file-path=/usr/local/php/etc \     #指定php.ini位置

--enable-inline-optimization \                            #開啓內聯優化(優化選項

--disable-debug \                                                #禁用debug優化選項

--disable-rpath \                                                  #禁止傳遞附加的運行時庫搜索路徑優化選項

--enable-shared \                                                #容許編譯共享庫優化選項

--enable-opcache \                                             #開啓opcache,加快php的響應速度

--enable-fpm \                                                    #PHP FastCGI管理器( nginx把http請求變量,如get,user_agent轉發給php進程,即php獨立進程,與nginx進行通信,稱爲fastcgi運行方式)

--with-mysql=mysqlnd \                                    #Mysql Native Driver,php內置mysql原生驅動,與libmysql擴展相比,好處是,主要防止license糾紛(mysql屬於 oracle公司,防止版權糾紛)和性能優化

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-gettext \                                                    #打開GNU的gettext支持,編碼庫用到

--enable-mbstring \                                             #多字節,字符串的支持

--with-iconv \                                                       #打開iconv函數,字符集間的轉換

--with-mcrypt=/usr/local/mcrypt \                     #yum安裝libmcrypt的話不須要設置路徑,源碼下載,解壓安裝的話,須要指定安裝目錄

--with-mhash \

--with-openssl \

--enable-bcmath \

--enable-soap \

--with-libxml-dir \

--enable-pcntl \

--enable-shmop \

--enable-sysvmsg \

--enable-sysvsem \

--enable-sysvshm \

--enable-sockets \

--with-curl \

--with-zlib \

--enable-zip \

--with-bz2

報錯libcurl庫未安裝

wget http://curl.haxx.se/download/curl-7.46.0.tar.gz

tar zxvf curl-7.46.0.tar.gz

cd curl-7.46.0

./configure --prefix=/usr/local/curl

make  && make install

報錯libmcrypt未安裝

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

tar zxvf libmcrypt-2.5.7.tar.gz

cd libmcrypt-2.5.7.tar.gz

./configure --prefix=/usr/local/mcrypt

make  && make install


make && make install

cp /usr/local/src/php-5.5.31/php.ini-development /usr/local/php/lib/php.ini

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

/usr/local/php/sbin/php-fpm

把php-fpm加入path鏈接

ln -s /usr/local/php/sbin/php-fpm /bin/php-fpm

相關文章
相關標籤/搜索