【发布时间】:2020-07-15 08:06:54
【问题描述】:
我在本地机器上创建了 Laravel 项目,并且还创建了数据库。在本地机器上,一个项目运行没有任何问题,但是我将项目文件上传到了 public_html 文件夹内的分片服务器 Cpanel 中,我访问了它说的 URL 此页面不工作,HTTP 错误 500。
Cpanel PHP 版本为 7.0 Laravel 版本是 5.6
但我将公用文件夹中的内容文件移动到根文件夹(public_html),并更改了 index.php 文件中的路径
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
还有 server.php 文件我也改成这样的路径。
if ($uri !== '/' && file_exists(__DIR__.'/public_html'.$uri)) {
return false;
}
require_once __DIR__.'/public_html/index.php';
还有我的 htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “alt-php70” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-alt-php70 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
请帮助解决此问题。
【问题讨论】: