温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

使用composer怎么安装thinkphp6.0框架

发布时间:2021-02-25 16:55:49 来源:亿速云 阅读:196 作者:Leah 栏目:开发技术

这篇文章将为大家详细讲解有关使用composer怎么安装thinkphp6.0框架,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

安装composer -vvv的参数是表示展示安装进度,测试时使用其他参数安装失败,一直卡着不动

curl -vvv https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

先安装下git,才能clone下github上的代码

apt-get install git

在创建项目之前,要安装php的扩展和unzip命令,没有这几个扩展后面创建项目不成功

apt-get install php7.3-mbstring php7.3-zip
apt-get install unzip

如果遇到警示,不准使用root执行,可以直接忽略不用管就行,没必要使用一个非root用户。先把镜像站给设置了,再去创建项目,否则会卡住一动不动

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
composer create-project topthink/think=6.0.x-dev thinkphp

框架代码下载完成后,要把根目录的.example.env 改成.env,这样默认是开启了调试模式,可以看到代码中的错误
配置nginx的重写用来去除index.php前缀,配置pathinfo变量传递才能使用tp6.0的路由
thinkphp下的nginx配置文件如下:

server {
  listen    80;
  server_name tp.com;
  access_log /var/log/nginx/tp.com.access.log main;
  error_log /var/log/nginx/tp.com.error.log;
  root  /var/www/html/thinkphp/public;

  if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php?s=$1 last;
       break;
   }
  location / {
    index index.html index.php;
  }
  location ~ \.php$ {
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    include    fastcgi_params;
  }
}

关于使用composer怎么安装thinkphp6.0框架就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI