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

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

问题描述

我正在尝试将XAMPP与NetBeans for PHP一起使用.当我将文件移到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即可(单击Stop,然后单击Apache标签旁边的Start).

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天全站免登陆