我将我的mac更新到最新版本的操作系统.当我尝试运行PHP项目时,浏览器显示php代码而不是解释它.我注意到在新的操作系统中,php是在7.1版本中.我在httpd.conf中使用自制程序和更改模块安装了5.6(我需要它):
LoadModule php5_module
/usr/local/Cellar/php56/5.6.31_7/libexec/apache2/libphp5.so
这是apache错误日志:
[Tue Sep 26 23:59:38.600410 2017] [mpm_prefork:notice] [pid 980]
AH00169: caught SIGTERM, shutting down [Tue Sep 26 23:59:38.622998
2017] [core:notice] [pid 980] AH00060: seg fault or similar nasty
error detected in the parent process AH00557: httpd:
apr_sockaddr_info_get() failed for MacBook-Pro-Kamil.local AH00558:
httpd: Could not reliably determine the server’s fully qualified
domain name, using 127.0.0.1. Set the ‘ServerName’ directive globally
to suppress this message [Tue Sep 26 23:59:48.838005 2017]
[mpm_prefork:notice] [pid 991] AH00163: Apache/2.4.27 (Unix)
PHP/5.6.31 configured — resuming normal operations [Tue Sep 26
23:59:48.838097 2017] [core:notice] [pid 991] AH00094: Command line:
‘/usr/sbin/httpd -D FOREGROUND’
解决方法:
将以下行添加到我的httpd.conf文件中修复了问题:
<code>AddType x-httpd-php .php AddHandler application/x-httpd-php .php .php5 </code>
希望这有帮助!
编辑:只是为了提供更多的细节,正如crmpicco建议的那样,我也用旧的Sierra替换了新的High Sierra httpd.conf和httpd-vhosts.conf文件,如下所示:
<code>mv httpd-vhosts.conf~previous httpd-vhosts.conf mv httpd.conf~previous httpd.conf </code>
即使在完成所有这些并重新启动Apache之后,它仍然无法正常工作 – 必须重新启动才能使所有内容生效.
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!