xampp 找不到我的主文件夹--Mac os x [英] xampp is not finding my home folder --Mac os x

查看:24
本文介绍了xampp 找不到我的主文件夹--Mac os x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 XAMPP 与用于 PHP 的 NetBeans 一起使用.当我将文件移动到 htdocs 文件夹时,一切正常.但是,当它们位于主文件夹中时,XAMPP 找不到它们.以下是我遵循的 XAMPP 的说明,但它不起作用.

I am trying to use XAMPP with NetBeans for PHP. When I move my files to the htdocs folder everything works fine. However when they are in the home folder XAMPP cannot find them. Below is the instruction from XAMPP I followed it but it's not working.

     **Where should I put my Websites?**
     You can put your Websites in /Applications/XAMPP/htdocs/ 
     and access them via http://localhost/

     Or you put your Websites in the Sites-Folder in your Home 
     and access them via http://localhost/~leslie/.

推荐答案

您可以按照以下说明轻松更改文档根目录:

You can change your document root pretty easily by following these instructions:

  1. 找到名为 httpd.conf 的文件.我的位于这个目录中:/Applications/XAMPP/etc
  2. 找到以下行:

  1. Locate the file called httpd.conf. Mine is located in this directory: /Applications/XAMPP/etc
  2. Find the line that says:

DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"

将路径更改为您希望文件所在的位置.使用根目录的绝对路径(即,如果您使用的是 Unix/Linux,则它应以 / 开头,如果您使用的是 Windows,则应以 开头).

Change the path to where you want your files to live. Use an absolute path from the root directory (i.e. it should start with a / and if you're using Unix/Linux and a if you're on Windows).

仍然在 httpd.conf 文件中,向下滚动几行,直到看到以下文本:

Still in the httpd.conf file, scroll down a few lines until you see this text:

# This should be changed to whatever you set DocumentRoot to.
 <Directory "/Applications/XAMPP/xamppfiles/htdocs">

并将路径替换为您在步骤 3 中键入的任何内容.

and replace the path with whatever you typed in step 3.

这部分很重要.为了使这些更改发生,您需要重新启动 Apache(否则它将不起作用).由于您使用的是 XAMPP,因此只需使用 GUI 执行此操作(单击停止,然后单击 Apache 标签旁边的开始).

This part is important. In order for these changes to take place, you need to restart Apache (otherwise it won't work). Since you're using XAMPP, just use the GUI to do this (click Stop, and then Start next to the Apache label).

现在,您可以将 Web 内容放入新目录(即您的案例中的主文件夹)

Now, you can put your web content in the new directory (i.e. the home folder in your case)

另一方面,如果您想添加一个额外的目录来提供文件,请找到上述步骤 1 中提到的 httpd.conf 文件,然后添加以下行:

If, on the other hand, you want to add an additional directory to serve files from, locate the httpd.conf file mentioned in step 1 above, and add this line:

Alias /home ~/
<Directory ~/>
Order allow,deny
Allow from all
</Directory> 

重启 Apache现在,您可以在浏览器中访问 localhost/home ,除了文档根目录中的文件(默认情况下为 htdocs,或者您使用以下步骤将其更改为任何内容)之外,它还将提供主目录中的文件以上).

Restart Apache Now, you can visit localhost/home in your browser and it will serve files from your home directory in addition to the files in your document root (htdocs by default, or whatever you change it to using the steps above).

这篇关于xampp 找不到我的主文件夹--Mac os x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆