Laravel MAMP 虚拟主机问题

Laravel MAMP Vhosts issue

在虚拟主机中进行以下配置。当我通过 MAMP 运行 它总是 returns 500 错误。不知道哪里出了问题。使用 valet 停止了 mamp 和 运行 它。 laravel 网站 运行 成功。 bootstrap/cache 的权限和存储看起来不错。错误日志是空的,不能在 .env 文件中调试和调试设置设置为 true。仅访问日志存在 500 错误。下面是我为 MAMP 使用的 vhosts 配置。 vhosts 文件中的其他网站工作。

<VirtualHost *:80>
 ServerName elearn.localhost
 ServerAlias elearn.localhost
 DocumentRoot "/Users/user1/code/elearn/public"
 ErrorLog "/Users/user1/logs/elearn.localhost-error_log"
 CustomLog "/Users/user1/logs/elearn.localhost-access_log" common
  <Directory "/Users/user1/code/elearn/public">
            DirectoryIndex index.php
   Options +Indexes +Includes +FollowSymLinks +MultiViews
   AllowOverride All
   Order allow,deny
   Allow from all
   Require all granted
   Satisfy Any
 </Directory>
</VirtualHost>

好的,清单:

  • MAMP 运行 是否属于您的用户?
  • 确保不是权限问题:commit, chmod 777 on project root, try again, if you still get 500 then it's ruling out
  • 停止 valet,重新启动 mamp,以确保没有服务部件发生冲突
  • 删除 vendor 文件夹并重新安装 composer,最好安全然后抱歉
  • 最后,在任何路由中添加一个dd()并测试它,如果你看到dd,意味着它与mamp、valet或laravel无关,可能是配置、驱动程序或其他问题。

您使用的 Laravel 是什么版本,如果是 5.6,请确保您 运行 PHP 在 MAMP 中至少是 7.1 - 我自己就犯规了次数?