php怎麼編譯安裝?
#php7.0編譯安裝
#1.解壓縮安裝
tar zxvf php-7.0.2.tar.gz cd php-7.0.2
2.安裝依賴函式庫:
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel libxslt-devel curl-devel
3.編譯安裝,參數如下:
./configure --prefix=/usr/local/php \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip
4.編譯安裝
make && make install
5.預設設定檔拷貝
cp 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 cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm
要注意的是php7中www.conf這個設定檔配置phpfpm的埠號等信息,如果你修改預設的9000埠號需在這裡改,再改nginx的設定
6.啟動php- fpm
/etc/init.d/php-fpm
7.設定nginx開啟php-fpm模組:
location ~ \.php$ { root /usr/local/nginx/html/question; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
更多PHP相關知識,請造訪PHP中文網!
以上是php怎麼編譯安裝的詳細內容。更多資訊請關注PHP中文網其他相關文章!