centos/redhat 7
wgettar -xf php-5.6.0.tar -c /usr/local/src/
yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel
3.1 在centos 7源中不能安裝libmcrypt-devel,由於版權的原因沒有自帶mcrypt的包
解決方法一:
1、安裝第三方yum源
wgetsh ./atomic
2、使用yum命令安裝
yum install php-mcrypt libmcrypt libmcrypt-devel
解決方法二:
libmcrypt原始碼安裝方法:
cd /usr/local/srcwget
tar -xf libmcrypt-2.5.8.tar.gz
cd /usr/local/src/libmcrypt-2.5.8
./configure --prefix=/usr/local
make
make install
groupadd phpuseradd -g php -s /sbin/nologin -m php
cd /usr/local/src/php-5.6.0/引數說明./configure \
--prefix=/usr/local/php56 \
--with-config-file-path=/usr/local/php56/etc \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--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-bz2 \
--with-readline
""" 安裝路徑 """--prefix=/usr/local/php56 \
""" php.ini 配置檔案路徑 """
--with-config-file-path=/usr/local/php56/etc \
""" 優化選項 """
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
""" 啟用 opcache,預設為 zendoptimizer+(zendopcache) """
--enable-opcache \
""" fpm """
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
""" mysql """
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
""" 國際化與字元編碼支援 """
--with-gettext \
--enable-mbstring \
--with-iconv \
""" 加密擴充套件 """
--with-mcrypt \
--with-mhash \
--with-openssl \
""" 數學擴充套件 """
--enable-bcmath \
""" web 服務,soap 依賴 libxml """
--enable-soap \
--with-libxml-dir \
""" 程序,訊號及記憶體 """
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
""" socket & curl """
--enable-sockets \
--with-curl \
""" 壓縮與歸檔 """
--with-zlib \
--enable-zip \
--with-bz2 \
""" gnu readline 命令列快捷鍵繫結 """
--with-readline
make -j8make install
配置檔案:
cp php.ini-development /usr/local/php56/etc/php.ini
php-fpm 服務
cp /usr/local/php56/etc/php-fpm.conf.default /usr/local/php56/etc/php-fpm.confcp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm56
chmod +x /etc/init.d/php-fpm56
啟動 php-fpm
service php-fpm56 start
[root@ping ~]# source /etc/profile[root@ping ~]# tail -1 /etc/profile
export path=$path:$home/bin:/usr/local/php56/bin
linux debian 編譯安裝php5 6
安裝編譯程式 apt get install gcc apt get install make apt get install libxml2 apt get install libxml 2.6 dev 建立安裝目錄 mkdir usr local php mkdir usr local php ...
原始碼編譯安裝php5 6
cd usr local src wget net get php 5.6 24.tar gz from this mirror mv mirror php 5.6 24.tar gztar zxvf php 5.6 24.tar gzcd php 5.6 24xml擴充套件 apt get ins...
CentOS下編譯安裝PHP5 6
目錄 安裝php依賴的擴充套件 編譯php 1 configure prefix usr local php with config file path usr local php etc enable fpm with fpm user php fpm with fpm group php fpm...