Home > PHP Framework > ThinkPHP > body text

What should I do if I get an error when deploying thinkphp5 in Pagoda?

藏色散人
Release: 2022-12-19 11:04:58
Original
1582 people have browsed it

宝塔部署thinkphp5报错的解决办法:1、打开宝塔服务器,安装php pathinfo扩展并启用;2、配置“.access”文件,内容为“RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]”;3、在网站管理里面,启用thinkphp的伪静态即可。

What should I do if I get an error when deploying thinkphp5 in Pagoda?

本教程操作环境:Windows10系统、thinkphp5版、Dell G3电脑。

宝塔部署thinkphp5报错怎么办?

宝塔服务器面板 部署 thinkphp5 坑

thinkphp5 在宝塔服务器上部署,出现的问题:

 

1. File not found.

  原因: 宝塔服务器默认不支持 pathinfo 的路径访问;需要在软件 - PHP - 管理里面,安装php pathinfo 扩展,并启用;

                   thinkphp 在入口文件同级下,有个 .access 文件,需要配置;官方文档中有说明,但是有个地方是不正确的

                   正确的配置应该如下:

                     


  Options +FollowSymlinks -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
Copy after login

   特别注意   index.php?s=

这个问题搞了2天,纠结了好久。无意中尝试发现是路径的问题。太坑。

2.网站管理里面,需要启用 thinkphp 的伪静态。

 

完成上面2步,基本上能解决路径不对的问题。   

 

路径不对,主要还是thinkphp的路由问题,可能版本不一样,都会有所区别。需要具体视情况来分析了。

推荐学习:《PHP视频教程》《thinkPHP视频教程

The above is the detailed content of What should I do if I get an error when deploying thinkphp5 in Pagoda?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!