PHP thinkPHP6.0 部署

Centos7使用yum安装PHP7.2

一、卸载旧版本(如果确认没有可以直接跳过)

rpm -qa | grep php
rpm -e php-cli
rpm -e php-common
........

  二、安装rpm源

# 命令行执行
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

# 看一下加好源后的结果
rpm -qa | grep php

三、安装PHP

 

# 一把梭,其他的可以后续再加
yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
 
# 看一下安装好的版本信息
php -v

 

 

PHP thinkPHP6.0 部署

 

// 1. 下载composer.phar:

curl -sS https://getcomposer.org/installer | php

 

// 2. 将 composer 命令移动到bin目录,使之全局可用

mv composer.phar /usr/local/bin/composer

 

 

操作步骤:      1. git bash到要安装的地方        2. 执行命令: composer create-project topthink/think tp6   出现的错误:      [InvalidArgumentException]   Could not find package topthink/think with stability stable.   解决方案: 删除之前的镜像:composer config -g --unset repos.packagist   Nginx 配置
server {
    listen       80;
    server_name  pj.arrating.com.cn;
    root   /opt/www/tp/public;
    index  index.php index.html index.htm;
    #charset koi8-r;
    
    access_log /dev/null;
    #access_log  /var/log/nginx/nginx.localhost.access.log  main;
    error_log  /var/log/nginx/nginx.localhost.error.log  warn;
    
    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location / {
        #访问路径的文件不存在则重写URL转交给ThinkPHP处理
        if (!-e $request_filename) {
           rewrite  ^/(.*)$  /index.php/$1  last;
           break;
        }
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
        expires 100d;
    }
    location ~ .*\.(js|css)?$ {
        expires 30d;
    }
    location ~ \.php(/|$) {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        include        fastcgi.conf;
        set $fastcgi_script_name2 $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {
            set $fastcgi_script_name2 $1;
            set $path_info $2;
        }
        fastcgi_param   PATH_INFO $path_info;
        fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;
        fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

 

 

 

上一篇:Linux 系统中的yum指令


下一篇:Centos8.3下安装MySQL8.0