微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

安装PHP到UbuntuAPT

运行环境

系统版本:Ubuntu 16.04.2 LTS
软件版本:PHP-5.6
硬件要求:无

安装过程

1、安装APT存储库

APT存储库由PPA提供。

root@localhost:~# apt-get install python-software-properties
root@localhost:~# add-apt-repository ppa:ondrej/PHP
root@localhost:~# apt-get update

2、安装PHP5.6和常用扩展库

root@localhost:~# apt-get -y install PHP5.6 PHP5.6-bcmach PHP5.6-fpm PHP5.6-mcrypt PHP5.6-mbstring PHP5.6-curl PHP5.6-cli PHP5.6-MysqL PHP5.6-gd PHP5.6-intl PHP5.6-xsl PHP5.6-zip PHP5.6-soap  PHP5.6-xml 

3、启动PHP-FPM服务

root@localhost:~# systemctl start PHP5.6-fpm

4、配置Nginx反代PHP

root@localhost:~# vim /etc/Nginx/conf.d/PHP56
server {
        listen 80;
        server_name  _PHP;
        root   "/var/www/html/";

        location / {
                index index.PHP index.html;
                if (!-e $request_filename){
                        rewrite  ^(.*)$  /index.PHP?s=$1  last;
                break;
                }
        }

        location ~ ^.*\.PHP(.*)$ {
            fastcgi_pass   unix:/run/PHP/PHP7.0-fpm.sock;
            fastcgi_index  index.PHP;
            fastcgi_param  SCRIPT_FILENAME  /home/mk/wstmart$fastcgi_script_name;
            include        fastcgi_params;
        }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐