中文字幕理论片,69视频免费在线观看,亚洲成人app,国产1级毛片,刘涛最大尺度戏视频,欧美亚洲美女视频,2021韩国美女仙女屋vip视频

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
使用源碼編譯安裝PHP7
php7-install.md  

使用源碼編譯安裝PHP7

2015年6月11日,PHP官網(wǎng)發(fā)布消息,正式公開發(fā)布PHP7第一版的alpha版本.

### PHP7特性:

PHP 7.0.0 Alpha 1使用新版的ZendEngine引擎,帶來了許多新的特性,以下是不完全列表:
(1)性能提升:PHP7比PHP5.6性能提升了兩倍。 Improved performance: PHP 7 is upto twice as fast as PHP 5.6
(2)全面一致的64位支持。 Consistent 64-bit support
(3)以前的許多致命錯(cuò)誤,現(xiàn)在改成拋出異常。Many fatal errors are nowExceptions
(4)移除了一些老的不在支持的SAPI(服務(wù)器端應(yīng)用編程端口)和擴(kuò)展。Removal of old andunsupported SAPIs and extensions
(5)新增了空接合操作符。The null coalescing operator (??)
(6)新增加了結(jié)合比較運(yùn)算符。Combined comparison Operator (<=>)
(7)新增加了函數(shù)的返回類型聲明。Return Type Declarations
(8)新增加了標(biāo)量類型聲明。Scalar Type Declarations
(9)新增加匿名類。Anonymous Classes

### 系統(tǒng)環(huán)境:
```
Mac-mini:~ WangTom$ uname -mnprs
Darwin Mac-mini.local 14.3.0 x86_64 i386

Mac-mini:~ WangTom$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.3
BuildVersion: 14D136
```

### 源碼安裝PHP7:

PHP7下載地址:https://downloads.php.net/~ab/

```
$ wgethttps://downloads.php.net/~ab/php-7.0.0alpha1.tar.bz2
$ tar jxf php-7.0.0alpha1.tar.bz2
$ cd php-7.0.0alpha1

$ ./configure
... ...
checking size of long... (cached) 8
checking size of long long... (cached) 8
checking for iconv support... yes
checking for iconv... no
checking for libiconv... no
configure: error: Please specify the install prefix of iconvwith --with-iconv=

```

安裝 libiconv (字符編碼轉(zhuǎn)換庫)
網(wǎng)站地址: http://www.gnu.org/software/libiconv/
當(dāng)前版本:http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

```
$ wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
$ tar zxf libiconv-1.14.tar.gz
$ cd libiconv-1.14
$ ./configure --prefix=/usr/local/lib/libiconv
$ make
$ sudo make install
```


配置參數(shù)
```
$ ./configure --prefix=/usr/local/php7 \
--enable-fpm \
--with-config-file-path=/usr/local/php7/etc \
--with-iconv=/usr/local/lib/libiconv \

執(zhí)行configure配置后,可以看到有如下結(jié)果:
... ...
Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands 
WangTomdeMacBook-Pro:php-7.0.0alpha1wangtom$ 
```
$ make
$ make test
$ sudo make install

查看PHP7是否安裝成功
````
WangTomdeMacBook-Pro:php-7.0.0alpha1 wangtom$/usr/local/php7/bin/php -v
PHP 7.0.0alpha1 (cli) (built: Jun 20 201500:04:19) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 ZendTechnologies

Mac-mini:~ WangTom$ sudo ln -s /usr/local/php7/bin/php/usr/bin/php7

Mac-mini:~ WangTom$ php -v
PHP 5.5.20 (cli) (built: Feb 25 2015 23:30:53)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 ZendTechnologies

Mac-mini:~ WangTom$ php7 -v
PHP 7.0.0alpha1 (cli) (built: Jun 23 2015 17:24:34)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 ZendTechnologies

Mac-mini:php-fpm.d WangTom$ which php
/usr/bin/php
Mac-mini:php-fpm.d WangTom$ which php7
/usr/bin/php7
```

### 配置PHP-FPM: 

Nginx不支持對(duì)外部程序的直接調(diào)用或者解析,所有的外部程序(包括PHP)必須通過FastCGI接口來調(diào)用。
PHP-FPM是一個(gè)PHP FastCGI管理器,新版的PHP已經(jīng)集成了php-fpm,在./configure的時(shí)候帶–enable-fpm參數(shù)即可開啟PHP-FPM.
FPM (FastCGI Process Manager) is an alternative PHP FastCGIimplementation with some additional features (mostly) useful forheavy-loaded sites.

啟動(dòng) PHP-FPM: 
```
Mac-mini:php7 WangTom$ /usr/local/php7/sbin/php-fpm
[23-Jun-2015 15:33:01] WARNING: Nothing matches the includepattern '/usr/local/php7/etc/php-fpm.d/*.conf' from/usr/local/php7/etc/php-fpm.conf at line 125.
[23-Jun-2015 15:33:01] ERROR: failed to open error_log(/usr/local/php7/var/log/php-fpm.log): Permission denied (13)
[23-Jun-2015 15:33:01] ERROR: failed to post process theconfiguration
[23-Jun-2015 15:33:01] ERROR: FPM initialization failed
```
提示錯(cuò)誤說/usr/local/php7/var/log/php-fpm.log 沒權(quán)限,就給777權(quán)限:
$ chmod 777 /usr/local/php7/var/log/

修改 php-fpm 配置文件:
$ cd /usr/local/php7/etc/
$ cp php-fpm.conf.default php-fpm.conf
$ vim php-fpm.conf
  > 打開error_log這一行的注釋,默認(rèn)該項(xiàng)被注釋掉,若不修改會(huì)出現(xiàn)提示log文件路徑不存在
  > error_log =/usr/local/php7/var/log/php-fpm.log 
  > 打開inclue這一行的注釋
  >include=/usr/local/php7/etc/php-fpm.d/*.conf

修改 /usr/local/php7/etc/php-fpm.d/www.conf 文件:
如果這個(gè)文件不存在,就從default復(fù)制一份:
$ cd /usr/local/php7/etc/php-fpm.d/
$ cp www.conf.default www.conf
將配置文件中的 user 和 group 部分的 nobody 改成 www:
$ vim /usr/local/php7/etc/php-fpm.d/www.conf
  > user  = www 
  > group = www  

開始啟動(dòng) php-fpm:
```
Mac-mini:php-7.0.0alpha1 WangTom$/usr/local/php7/sbin/php-fpm
[23-Jun-2015 18:30:48] NOTICE: [pool www] 'user' directive isignored when FPM is not running as root
[23-Jun-2015 18:30:48] NOTICE: [pool www] 'group' directive isignored when FPM is not running as root
[23-Jun-2015 18:30:48] ERROR: unable to bind listening socketfor address '127.0.0.1:9000': Address already in use (48)
[23-Jun-2015 18:30:48] ERROR: FPM initialization failed
```
這個(gè)錯(cuò)誤問題有兩個(gè):(1)沒有使用root賬戶執(zhí)行啟動(dòng)命令 (2)端口9000被占用
解決方法:
使用root賬戶執(zhí)行php-fpm啟動(dòng),或 sudo /usr/local/php7/sbin/php-fpm 
關(guān)閉 PHP-fpm, 并重新啟動(dòng):
```
Mac-mini:~ WangTom$ lsof -P | grep ':9000' | awk '{print $2}'| xargs kill -9
Mac-mini:php-7.0.0alpha1 WangTom$ /usr/local/php7/sbin/php-fpm-t
[23-Jun-2015 18:30:25] NOTICE: configuration file/usr/local/php7/etc/php-fpm.conf test is successful
Mac-mini:~ WangTom$ sudo /usr/local/php7/sbin/php-fpm
Mac-mini:~ WangTom$ 
```

修改Nginx 配置: 
在 nginx.conf 配置文件server 部分增加fastcgi配置,并重新加載配置文件:
```
Mac-mini:~ WangTom$ sudo vim/usr/local/nginx/conf/nginx.conf

> location ~ \.php$ {
>  root html;
>  fastcgi_pass 127.0.0.1:9000;
>  fastcgi_index index.php;
>  fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;
>  include fastcgi_params;
> }

Mac-mini:~ WangTom$ sudo /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.confsyntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conftest is successful
Mac-mini:~ WangTom$ sudo /usr/local/nginx/sbin/nginx -sreload
Mac-mini:~ WangTom$
```

用到的一些命令:

uname: 用來獲取電腦和操作系統(tǒng)的相關(guān)信息
sw_vers: Mac下查看系統(tǒng)版本信息
lsof: 列出當(dāng)前系統(tǒng)打開文件(list open files)
which: 指令會(huì)在環(huán)境變量$PATH設(shè)置的目錄里查找符合條件的文件


參考鏈接:

- http://php.net/archive/2015.php#id2015-06-11-3
-http://www.hashbangcode.com/blog/compiling-and-installing-php7-ubuntu


[END]

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Nginx+Keepalived+Tomcat之動(dòng)靜分離的web集群
Linux三階段之九:期中架構(gòu)LNMP章節(jié)
shell實(shí)現(xiàn)一鍵安裝LNMP
centos6.2企業(yè)級(jí)LNMP環(huán)境搭建
實(shí)現(xiàn)動(dòng)靜分離的LNMMP網(wǎng)站架構(gòu)
應(yīng)用系統(tǒng)分布式構(gòu)建運(yùn)維
更多類似文章 >>
生活服務(wù)
熱點(diǎn)新聞
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服