Nginx編程開發教程之PHP編譯安裝方法,nginx編程開發

來源:互聯網
上載者:User

Nginx編程開發教程之PHP編譯安裝方法,nginx編程開發
擷取PHP:

????http://php.net/????

編譯安裝PHP:

????yum -y install libxml2-devel? ? #先安裝依賴包

????yum -y install curl-devel

????yum -y install libjpeg-devel

????yum -y install libpng-devel

????yum -y install freetype-devel

????yum install -y libmcrypt-devel

????./configure ? ?--prefix=/usr/local/php ? ? --enable-fpm ? ? --with-zlib ? ?--enable-zip ? ? --enable-mbstring ? ? --with-mcrypt ? ? --with-mysql ? ? --with-mysqli ? ?--with-pdo-mysql ? ? --with-gd ? ? --with-jpeg-dir ? ? --with-png-dir ? ? --with-freetype-dir ? ? --with-curl ? ? --with-openssl ? ? --with-mhash ? ? --enable-bcmath ? ? --enable-opcache?? ? #編譯

????

? ? make && make install????

????? ?

PHP和Nginx整合:? ? 配置PHP-FPM

????? ? cd?/usr/local/php/etc

????????cp php-fpm.conf.default php-fpm.conf

????????cp /tmp/php-5.6.33/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm? ? #配置service方式運行

????????chmod +x /etc/init.d/php-fpm

????????chkconfig --add php-fpm

????????

????????service php-fpm start? ? #netstat -tlnp|grep php 查看連接埠

????????service php-fpm reload

????????service php-fpm restart

????????service php-fpm stop

????配置PHP:????? ? cp /tmp/php-5.6.33/php.ini-development /usr/local/php/lib/? ? #選擇一個改為php.ini
????????cp /tmp/php-5.6.33/php.ini-development /usr/local/php/lib/
????????cp /tmp/php-5.6.33/php.ini-development /usr/local/php/lib/php.ini
? ? Nginx支援PHP:????????root html;
index index.html index.htm index.php;
? ? ? ? location ~ \.php$ {
? ? ? ? ?????try_files $uri =404
? ? ? ? ? ? fastcgi_pass ? 127.0.0.1:9000;
? ? ? ? ? ? #fastcgi_param ?SCRIPT_FILENAME ?/scripts$fastcgi_script_name;
? ? ? ? ? ? #include ? ? ? ?fastcgi_params;
include ? ? ? ?fastcgi.conf;
? ? ? ? }

? ?? ??

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.