Apache不提供php文件

时间:2016-04-23 19:44:31

标签: php macos apache

所以我试图让我的LAMP堆栈在我的Macbook中运行。我已经安装了apache但PHP无法运行。我在Brew中安装了php55并将模块加载到我的httpd.conf文件中,如下所示:

LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so

我已检查libphp5.so是否位于模块指向的位置,并且它在那里。

如果我检查我的apache error.log,我收到以下消息:

 [Sat Apr 23 21:36:59.307093 2016] [ssl:warn] [pid 7231] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
 [Sat Apr 23 21:36:59.358254 2016] [auth_digest:notice] [pid 7231] AH01757: generating secret for digest authentication ...
 [Sat Apr 23 21:36:59.360623 2016] [mpm_prefork:notice] [pid 7231] AH00163: Apache/2.4.18 (Unix) LibreSSL/2.2.6 PHP/5.5.34 configured -- resuming normal operations
 [Sat Apr 23 21:36:59.360661 2016] [core:notice] [pid 7231] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

我错过了一些东西,但我现在还不太确定。

2 个答案:

答案 0 :(得分:1)

将以下行添加到httpd.conf:

AddHandler application/x-httpd-php .php
apache重新启动后,一切都应该正常工作

答案 1 :(得分:1)

您是否还更新了Apache配置以识别.php个扩展程序?

AddType application/x-httpd-php .php

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>