php Mac 或 Mac OS X 中的 localhost 文件夹在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5365055/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 21:10:26  来源:igfitidea点击:

Where is localhost folder located in Mac or Mac OS X?

phpmacoseclipse-pdt

提问by Tassisto

I just started developing PHP projects on my mac (using PDT) and was wondering where localhost is located? How does Mac OS X serve websites, I haven't changed any settings during the installation of PDT.

我刚刚开始在我的 mac 上开发 PHP 项目(使用 PDT)并且想知道 localhost 位于哪里?Mac OS X 如何为网站提供服务,我在安装 PDT 期间没有更改任何设置。

回答by Chris Muench

There are actually two place where where mac os x serves website by default:

默认情况下,mac os x 服务网站实际上有两个地方:

/Library/WebServer/Documents --> http://localhost

/Library/WebServer/Documents --> http://localhost

~/Sites --> http://localhost/~user/

~/站点 --> http://localhost/~user/

回答by McKayla

The default Apache root folder (localhost/) is /Library/WebServer/Documents

默认的 Apache 根文件夹 (localhost/) 是 /Library/WebServer/Documents

Also, make sure you have the PHP5 module loaded in /etc/apache2/httpd.conf

另外,请确保您在 /etc/apache2/httpd.conf 中加载了 PHP5 模块

LoadModule php5_module libexec/apache2/libphp5.so

回答by Jason Sebring

For posterity

为后人

I never use PHP so I completely forgot where apache was installed on my mac as it was running on port 8080 mocking me, installed in a non-standard path. After giving up on the internet, I tried this...

我从不使用 PHP,所以我完全忘记了 apache 安装在我的 mac 上的位置,因为它在模拟我的 8080 端口上运行,安装在非标准路径中。在放弃互联网后,我尝试了这个......

httpd -t -D DUMP_INCLUDES

Because httpd was running it produced the httpd.config path and then the clouds parted and the sun shown brightly on my face. Victory!as within it lies the path to localhost.

因为 httpd 正在运行,它产生了 httpd.config 路径,然后乌云散开,阳光照耀在我的脸上。胜利!因为其中包含本地主机的路径。

ServerRoot "/your/path"

回答by Jason Sebring

Actually in newer Osx os's, this is stored in /Library/WebServer/Documents/

实际上在较新的 Osx 操作系统中,它存储在 /Library/WebServer/Documents/

The .en file is just an html file, but it needs special permissions to change, so I just made a folder for my stuff and then accessed it by user.local/Folder/file.html

.en 文件只是一个 html 文件,但它需要特殊的权限才能更改,所以我只是为我的东西创建了一个文件夹,然后通过以下方式访问它 user.local/Folder/file.html

回答by Ernest Friedman-Hill

There's no such thing as a "localhost" folder; the word "localhost" is an alias for your local computer. The document root for your apache server, by default, is "Sites" in your home directory.

没有“localhost”文件夹之类的东西;“localhost”一词是您本地计算机的别名。默认情况下,您的 apache 服务器的文档根目录是您的主目录中的“站点”。

回答by Rodrigo Carvalho

Macintosh HD/Library/WebServer/Documents

Macintosh HD/图书馆/网络服务器/文档

Macintosh HD is the name of your HD

Macintosh HD 是您的 HD 的名称

If you can't find it: Open Finder > click "Go" at the very top > Computer > Your HD should be there. You can drag and drop the HD to favorites on the left.

如果找不到:打开 Finder > 单击最顶部的“转到”> 计算机 > 您的 HD 应该在那里。您可以将 HD 拖放到左侧的收藏夹中。

回答by Rajesh M

open the 'Finder' in Mac and Command+Shift+Gand type in the path:/usr/local/zend/apache2/htdocs. path will open then create/paste your web page/application then check it on the browser.

在 Mac 和Command+Shift+G 中打开“Finder”并输入路径:/usr/local/zend/apache2/htdocs。path 将打开然后创建/粘贴您的网页/应用程序,然后在浏览器上检查它。

回答by Dragi

Applications -> XAMPP -> htdocs This is the place where you should put your files for the website you're building.

应用程序 -> XAMPP -> htdocs 这是您应该为正在构建的网站放置文件的地方。