欢迎您光临自学哈网,只为分享网络知识教程,供大家学习参考!

「自学哈网」解决composer安装使用thinkphp6.0框架

作者 : 自学哈 本文共1096个字,预计阅读时间需要3分钟 2023-03-7 共112人阅读
也想出现在这里? 联系我们

安装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/comp oser/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;

}

}

本站声明:
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!

自学哈网 » 「自学哈网」解决composer安装使用thinkphp6.0框架
也想出现在这里? 联系我们
© 2022 Theme by - 自学哈网 & WordPress Theme. All rights reserved 浙ICP备2022016594号