51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

安装php7

# 安装 php7 {#安装-php7}

本文讲述 php7 的安装步骤。

# 1. 约定 {#_1-约定}

操作系统:Ubuntu 16.04.3 LTS

# 2. 安装步骤 {#_2-安装步骤}

# 2.1 安装 {#_2-1-安装}

apt-get update
apt-get install php php-pear nginx vim curl

# 2.2 配置 {#_2-2-配置}

vim /etc/nginx/sites-enabled/default

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
    #
    #       # With php7.0-cgi alone:
    #       fastcgi_pass 127.0.0.1:9000;
    #       # With php7.0-fpm:
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    #}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#       deny all;
}

# 2.3 启动服务 {#_2-3-启动服务}

service php7.0-fpm start
service nginx start

# 3. 验证 {#_3-验证}

vi /var/www/html/test.php

<?php
echo phpinfo();
?>

curl http://localhost/test.php

赞(2)
未经允许不得转载:工具盒子 » 安装php7