mac上編譯安裝lnmp環境(php7.0)
阿新 • • 發佈:2019-02-18
系統環境:OS X EI Capitan 10.11.6 (15G31)
web環境:php7.0.13+nginx1.11.6+mysql5.7(解壓版)
1.php的擴充套件安裝
1.1png安裝(gd庫)
tar zxvf libpng-1.6.26.tar.xz
cd libpng-1.6.26
./configure --prefix=/www/server/extension/php/libpng
make &make install
1.2jpeg安裝(gd庫)
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9/
./configure --prefix=/www/server/extension/php/libjpeg
make && make install
1.3libiconv(字元編碼)
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/www/server/extension/php/libiconv
make && make install
1.4mhash
tcd
cd mhash-0.9.9.9
./configure --prefix=/www/server/extension/php/libmhash
make && make install
1.5libmcrypt
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/www/server/extension/php/libmcrypt
make && make install
1.6openssl安裝
tar zxvf openssl-1.0.2f.tar.gz
cd openssl-1.0.2f
./config --prefix=/www/server/extension/php/openssl
make && make install
1.8libxml2
tar zxvf libxml2-sources-2.9.2.tar
cd libxml2-2.9.2
./configure --prefix=/www/server/extension/php/limxml2
make && make install
1.9 curl 安裝
tar zxvf curl-7.46.0.tar.gz
cd curl-7.46.0
./configure --prefix=/www/server/extension/php/curl --with-ssl=/www/server/extension/php/openssl/
make && make install
1.20freetype
tar zxvf freetype-2.1.10.tar.bz2
cd freetype-2.1.10
./configure --prefix=/www/server/extension/php/freetype
2.0安裝php
編譯引數設定
./configure \
--prefix=/www/server/php/php7.0 \
--with-config-file-path=/www/server/php/php7.0 \
--enable-pdo \
--with-pdo-mysql \
--with-mysql-sock=/tmp/mysql.sock \
--enable-opcache \
--enable-cgi \
--enable-fpm \
--enable-sockets \
--enable-mbstring \
--enable-mbregex \
--enable-bcmath \
--enable-session \
--enable-xml \
--enable-zip \
--with-zlib \
--with-gd \
--with-freetype-dir=/www/server/extension/php/freetype \
--with-png-dir=/www/server/extension/php/libpng \
--with-jpeg-dir=/www/server/extension/php/libjpeg \
--with-curl=/www/server/extension/php/curl \
--with-mhash=/www/server/extension/php/libmhash \
--with-mcrypt=/www/server/extension/php/libmcrypt \
--with-iconv=/www/server/extension/php/libiconv
到此php的安裝結束了,遇到的問題就是編譯php時候加入ssl問題,可能導致編譯失敗或者報錯,去除就是了!
注意:啟動的時候非當前使用者啟動時候用sudo哦,和centos不一樣,centos一般都是root,特殊情況就時給個和root許可權一樣的帳號,很少有單獨的那種使用者!