宝塔面板安装thinkphp6详细图文教程

首先安装linux系统+宝塔面板,安装nginx+mysql+php7.1以上版本

禁用函数

passthru() 、 putenv() 、 pcntl_signal() 、 proc_open()

图片[1]-宝塔面板安装thinkphp6详细图文教程-曙光学习苑

安装 fileinfo 扩展

图片[2]-宝塔面板安装thinkphp6详细图文教程-曙光学习苑

安装composer

下载命令:

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

移动到/usr/bin/composer目录下,输入命令回车,按“Y”确认。以下移动命令:

mv composer.phar /usr/bin/composer

安装完成后,查看版本号命令:

composer --version

图片[3]-宝塔面板安装thinkphp6详细图文教程-曙光学习苑

至此,composer安装完成。

安装thinkphp

接着进入网站目录

cd /www/wwwroot/

我的目录是 thinkphp6 ,目录必须是空的。不然会报错:

In CreateProjectCommand.php line 371:
Project directory “/www/wwwroot/thinkphp6” is n

composer create-project topthink/think thinkphp6

修改网站的目录和运行目录

图片[4]-宝塔面板安装thinkphp6详细图文教程-曙光学习苑

输入网站绑定的域名或者绑定的ip地址就能打开thinkphp6的欢迎页了。

图片[5]-宝塔面板安装thinkphp6详细图文教程-曙光学习苑

恢复源码

需要把源码全部替换网站根目录(/www/wwwroot/thinkphp6)所有文件切换到网站目录下

cd /www/wwwroot/thinkphp6

接着运行

composer install

图片[6]-宝塔面板安装thinkphp6详细图文教程-曙光学习苑

查看运行状态:

cd 到 thinkphp 根目录:

cd /thinkphp/

运行:

php think run

查看当前版本:

php think version

最后别忘记了thinkphp的伪静态要添加

如果还是出现Driver [Think] not supported.

问题产生原因 :

Thinkphp 新版(6.0版本开始)不再内置 think-template 模板引擎,如果需要使用ThinkPHP 官方模板引擎,需要单独安装 think-view 模板引擎驱动扩展。
解决方法 :

使用 composer 下载安装 think-view 和 think-throttle 模板引擎驱动扩展。
需要删除根目录下的 composer.lock 文件。不然会报错:

./composer.json has been updated
Running composer update topthink/think-view
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files

命令:

composer require topthink/think-view
composer require topthink/think-throttle
© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
相关推荐
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容