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

MacOS Sierra下localhost/phpmyadmin访问404问题求助

Alright, let's break this down—you're hitting a classic Apache DocumentRoot vs. external directory issue, and yes, it's absolutely a configuration problem. Here are two solid fixes to get phpMyAdmin accessible at localhost/phpmyadmin:

Since Apache's DocumentRoot is set to ~/Sites/Meetings, it only looks for files and directories inside that folder when you hit localhost. To make phpmyadmin appear as a subdirectory here, create a symbolic link (soft link) pointing to your actual phpMyAdmin folder:

  • Open your terminal and run this command:
    ln -s ~/Sites/phpmyadmin ~/Sites/Meetings/phpmyadmin
    
  • Next, ensure Apache is allowed to follow symbolic links. Open your httpd.conf file and locate the <Directory> block for your Meetings folder (it’ll look like <Directory "/Users/YourUsername/Sites/Meetings">). Update it to include FollowSymLinks in the Options line:
    <Directory "/Users/YourUsername/Sites/Meetings">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    
  • Restart Apache to apply changes (use sudo apachectl restart on macOS, or sudo systemctl restart apache2 on most Linux distros).
Fix 2: Add an Alias Directly in Apache Configuration

If you don’t want a symbolic link cluttering your project directory, you can configure Apache to map the /phpmyadmin URL directly to your phpMyAdmin folder using an Alias:

  • Open httpd.conf and add these lines (preferably near other Alias directives or at the bottom of the file):
    Alias /phpmyadmin "/Users/YourUsername/Sites/phpmyadmin"
    
    <Directory "/Users/YourUsername/Sites/phpmyadmin">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    
    Note: Replace YourUsername with your actual system username—using an absolute path avoids issues with Apache not resolving ~ correctly.
  • Save the file and restart Apache as before.
Quick Permission Check

If you still encounter errors after trying either fix, double-check that Apache’s runtime user (usually _www on macOS, www-data on Linux) has access to your phpMyAdmin folder:

# For macOS
chmod -R 755 ~/Sites/phpmyadmin
chown -R _www:_www ~/Sites/phpmyadmin

# For Linux
chmod -R 755 ~/Sites/phpmyadmin
chown -R www-data:www-data ~/Sites/phpmyadmin

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 08:26:35