您好,登錄后才能下訂單哦!
PHP運行模式:
1)cgi 通用網關接口(Common Gateway Interface))
2) fast-cgi 常駐 (long-live) 型的 CGI
3) cli 命令行運行 (Command Line Interface)
4)web模塊模式 (apache等web服務器運行的模塊模式)
HTTPServer有三種架構比較流行:
(1)Apache+mod_php5
(2)lighttp+spawn-fcgi
(3)nginx+PHP-FPM
但在生產環(huán)境中,可能會遇到lamp架構與lnmp架構都在同一臺物理服務器的環(huán)境,此時:
若php版本高于(包括)5.4,則直接編譯php支持mod方式和php-cgi方式,參數如下:
./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm --with-gd --with-curl --with-jpeg-dir --with-zlib --with-png-dir --with-freetype-dir --enable-magic-quotes --with-iconv --enable-sockets --enable-bcmath --enable-zip --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-force-cgi-redirect --enable-ftp --enable-mbstring --with-config-file-path=/usr/local/php/etc --with-libxml-dir --with-openssl --enable-maintainer-zts --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-sysvsem --enable-shmop --enable-soap
若php版本為5.3,則會報錯如下:
+--------------------------------------------------------------------+ | *** ATTENTION *** | | | | You've configured multiple SAPIs to be build. You can build only | | one SAPI module and CLI binary at the same time. | +--------------------------------------------------------------------+
若php版本低于(等于)5.2,編譯參數同上,編譯不會報錯,但php-cgi命令不會安裝成功。解決辦法如下:
將mod_php和php-cgi方式分別指定不同目錄安裝,如下:
Apache+mod_php5
tar zxvf php-5.2.8.tar.gz gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1 cd php-5.2.8 patch -p1 < ../php-5.2.8-max-input-vars.patch ./configure --prefix=/usr/local/php --with-gd --with-curl --with-jpeg-dir --with-zlib --with-png-dir --with-freetype-dir --enable-magic-quotes --with-iconv --enable-sockets --enable-bcmath --enable-zip --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-force-cgi-redirect --enable-ftp --enable-mbstring --with-config-file-path=/usr/local/php/etc --with-libxml-dir --with-openssl --enable-maintainer-zts --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-sysvsem --enable-shmop --enable-soap
PHP-FPM
tar zxvf php-5.2.8.tar.gz gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1 cd php-5.2.8 patch -p1 < ../php-5.2.8-max-input-vars.patch ./configure --prefix=/usr/local/php-cgi --with-gd --with-curl --with-jpeg-dir --with-zlib --with-png-dir --with-freetype-dir --enable-magic-quotes --with-iconv --enable-sockets --enable-bcmath --enable-zip --enable-fastcgi --enable-fpm --enable-force-cgi-edirect --with-mysql=/usr/local/mysql --enable-force-cgi-redirect --enable-ftp --enable-mbstring --with-config-file-path=/usr/local/php-cgi/etc --with-libxml-dir --with-openssl --enable-maintainer-zts --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-sysvsem --enable-shmop --enable-soap
php版本支持mod與fcgi共存的發(fā)展規(guī)律,與nginx的普及范圍是有關系的
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。