在 mamp 上运行 php

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2283456/
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 05:52:18  来源:igfitidea点击:

running php on mamp

phpmamp

提问by Ali_IT

I already installed MAMP in my macbook pro. I want to run a php. what can i do?

我已经在我的 macbook pro 中安装了 MAMP。我想运行一个php。我能做什么?

采纳答案by Sarfraz

If you have done everything right, open your browser and type this:

如果您已正确完成所有操作,请打开浏览器并输入以下内容:

http://localhost

to see if it opens successfully and then you can open your sites.

查看它是否成功打开,然后您可以打开您的网站。

Also check out the mamp's documentation on how to configure it and run php scripts.

还可以查看 mamp 的文档,了解如何配置它和运行 php 脚本。

回答by Zack Burt

/Applications/MAMP/htdocs/hello.php

/Applications/MAMP/htdocs/hello.php

Will then appear in http://localhost:8888/hello.php

然后会出现在http://localhost:8888/hello.php

:)

:)

回答by TravisO

Drop the PHP file into the HTDOCs folder in MAMP, for example let's call it hello_world.php and now you can run it by going to:

将 PHP 文件放入 MAMP 中的 HTDOCs 文件夹中,例如,我们将其命名为 hello_world.php,现在您可以通过以下方式运行它:

http://localhost/hello_world.php

http://localhost/hello_world.php

回答by Dirk Einecke

Depending on the port settings of MAMP (Preferences -> Ports) you have to call http://localhost:8888/filename.php(MAMP ports) or http://localhost/filename.php(default ports). The file "filename.php" have to be located in this folder: /Applications/MAMP/htdocs/

根据 MA​​MP 的端口设置(首选项 -> 端口),您必须调用http://localhost:8888/filename.php(MAMP 端口)或http://localhost/filename.php(默认端口)。文件“filename.php”必须位于此文件夹中:/Applications/MAMP/htdocs/