MAMP不处理PHP

问题描述:

所以我与甲基苯丙胺工作在我的MacBook Pro(运行OS X 10.10),它工作正常,但现在不会MAMP PHP程序在所有。

So I was working with MAMP on my Macbook Pro (running OS X 10.10) and it was working fine, but now MAMP wont process PHP at all.

我有一个文件在/ MAMP / htdocs中/

I have a file named 'index.php' in /MAMP/htdocs/

它只有一个行(减去开幕前的第一个空间?):

It contains only one line (minus the first space before the opening ?):

< ?php echo "hello"; ?>

MAMP运行得很好,但是当我加载该文件,它只是直接输出code

MAMP runs just fine, but when I load the file it just outputs the code directly

http://imgur.com/a/Ay6km#1

如果我包括在index.php一些简单的HTML,像这样的:

If I include some simple HTML in the index.php, like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <?php echo "hello"; ?>
</body>
</html>

然后,它只是增加了PHP线作为该文件的注释。

Then it simply adds the PHP line as a comment to the file.

http://imgur.com/a/Ay6km#2

我就确定注释在/private/etc/apache2/httpd.conf文件中的LoadModule行。我不得不添加加入AddModule行,因为它不是在文件中的任何地方。

I made sure to uncomment the LoadModule line in the /private/etc/apache2/httpd.conf file. I had to add the AddModule line because it wasn't anywhere in the file.

我已经重新安装MAMP没什么区别。 MAMP运行PHP v5.5.14,缓存是关闭的。

I've reinstalled MAMP with no difference. MAMP is running PHP v5.5.14, cache is turned off.

我只是用一个简单的Apache服务器已经尝试通过运行须藤apachectl中启动(MAMP停止和重新启动之后),我没有在终端得到任何错误,但是当我尝试加载的http://本地主机网​​页找不到。

I've tried just using a simple Apache server (after stopping MAMP and restarting) by running sudo apachectl start, and I don't get any errors in Terminal, but when I try to load http://localhost the webpage is not found.

任何人有什么建议吗?有没有我可以检查错误的地方吗?

Anyone have any advice? Is there a place I can check for errors?

编辑:我的httpd文件的副本已被添加到注释

edit: a copy of my httpd file has been added to the comments

在PHP 文档说,的httpd.conf 应具有以下行:

The PHP documentation says that httpd.conf should have the following lines:

<IfModule mod_php5.c>
    # If php is turned on, we respect .php and .phps files.
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    # Since most users will want index.php to work we
    # also automatically enable index.php
    <IfModule mod_dir.c>
        DirectoryIndex index.html index.php
    </IfModule>
</IfModule>

此块从您的文件丢失。

检查其他步骤在上面的文档链接,以及

Check the other steps at the above documentation link as well.