我正在开发 Laravel API,在 localhost 中一切正常,我的所有请求都在工作。
但是当我将应用程序部署到我的服务器时,它停止工作。
我认为问题出在 .htaccess
文件中。当我输入我的网站 URL 时,出现 500 错误,如下图所示。
但是当我将像 unzipper.php
这样的 PHP 文件添加到我的 public_html
时,它没有问题。
我的.htaccess
是这样的:
<Limit GET POST PUT DELETE>
#For REST support
Allow from all
</Limit>
<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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(/)?$ public/index.php [L]
</IfModule>
我没有更改上面出现的错误文件中的任何内容。
答案 0 :(得分:2)
您需要在服务器上安装较新版本的 PHP 才能运行您的项目。您使用的版本不支持参数列表中的尾随逗号。
检查您的 composer.json
文件以了解您的项目需要什么版本的 PHP。