如何在 Ubuntu Linux 14.04 LTS 上安裝php7

輸入php

$ sudo apt-get install -y language-pack-en-base
$ sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/phpmysql

或者sql

$ sudo add-apt-repository ppa:ondrej/phpjson

而後更新源php7

$ sudo apt-get update php-fpm

而後安裝unix

$ sudo apt-get install php7.0 php7.0-cli php7.0-fpm php7.0-gd php7.0-json php7.0-mysql php7.0-readlinecode

 

而後編輯ngnix配置文件server

# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
                return 404;
        }
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
}
相關文章
相關標籤/搜索