You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac下用XAMPP本地部署Laravel遇UnexpectedValueException权限错误求助

Fixing Laravel Permission Denied Error on XAMPP (Mac)

Hey there, this is a super common snag when setting up Laravel on XAMPP for Mac—let’s get this sorted out step by step! That UnexpectedValueException is telling you your XAMPP Apache server doesn’t have write access to Laravel’s critical storage and bootstrap/cache directories (these are where logs, cache files, and other runtime data live).

1. Set Proper Directory Permissions

First, fire up your Terminal and navigate straight to your Laravel project root:

cd /opt/lampp/htdocs/app

Run these two commands to lock in the right access levels:

  • The first command sets safe, standard permissions: read/write/execute for the owner and group, read/execute for others (no overexposing your files):
    sudo chmod -R 775 storage bootstrap/cache
    
  • The second command ensures the XAMPP Apache user owns these directories (Mac’s XAMPP runs Apache as the _www user/group by default):
    sudo chown -R _www:_www storage bootstrap/cache
    

2. Verify the Fix

Refresh your localhost:8080/app/public page after running those commands—your error should vanish! If it’s still hanging around, double-check:

  • Did you run the commands from the correct project root (/opt/lampp/htdocs/app)?
  • Is _www the right user/group? If not, open XAMPP’s Apache config file (/opt/lampp/etc/httpd.conf) and look for the User and Group directives to confirm the correct owner.

A Quick Note on Security

You might see random suggestions to use chmod -R 777 storage—don’t do this. It gives full read/write access to every user on your system, which is a massive security risk (especially if you ever deploy this app to production). Stick with the 775 + proper ownership method—it’s safe and industry standard.

内容的提问来源于stack exchange,提问作者Vikash PR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 12:22:41