PHP信息页面未显示

PHP信息页面未显示

本文介绍了优山美地的Apache,PHP信息页面未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果这个问题适用于SO所以,如果它不不我喊不知道...

我已经摆脱了XAMPP,并尝试做在OS X中的一切。我跟着导游很多,但我卡在使PHP工作,浏览器不显示的phpinfo。我在10.10,阿帕奇/ 2.4.9,PHP 5.5.14。

我已经启用在conf文件的模块,我得到了本地主机/〜我/页面,显示我的目录。我的index.php文件中包含< PHP的phpinfo(); ?> ,但它只是原料输出code,而不是信息。主引导我一直this以下是。如果有任何额外的信息需要,请让我知道,我会提供。每个导游在这里结束了那里的信息应该是显示...为什么它不工作任何想法?

 
#这是主要的Apache HTTP服务器的配置文件。它包含的
#配置指令,让服务器的指令。
#见<网址:HTTP://httpd.apache.org/docs/2.4/>了解详细信息。
#特别是,看到
#<网址:HTTP://httpd.apache.org/docs/2.4/mod/directives.html>
#每个配置指令的讨论。

#不要只是简单的阅读说明书不求甚解
# 他们做什么。他们在这里只起提示。如果你不确定
#咨询在线文档。你被警告了。

#配置和日志文件名:如果文件名指定为许多
服务器的控制文件#开始/(或驱动器:/为Win32)中,
#服务器将使用绝对路径。如果文件名不*不*开始
#以/,ServerRoot的值是prepended - 如此日志/访问日志
#ServerRoot的带设置为在/ usr /本地/ Apache2的将被PTED间$ P $
#服务器的/ usr /本地/ Apache2的/日志/访问日志,而/日志/访问日志
#将PTED为/日志/访问日志'间$ P $。#
#ServerRoot的:目录树的顶部根据该服务器的
#配置,错误和日志文件保存。

#不要在目录路径的末尾添加斜线。如果你点
在非本地磁盘#ServerRoot的,请务必在指定本地磁盘
#互斥指令,如果使用基于文件的互斥。如果你想分享
#多的httpd守护进程相同的ServerRoot,您将需要改变
#至少PIDFILE。

ServerRoot的的/ usr#
#互斥:允许您设置互斥机制和互斥文件目录
#个人互斥体,或更改全局默认值

#取消和更改目录,如果互斥是基于文件和缺省
#互斥文件目录是不是在本地磁盘上或不适合某些
#其他原因。

#互斥默认:/私营/ var / run中#
#Listen:允许你将Apache绑定到特定的IP地址和/或
#端口,而不是默认的。另见的<&虚拟主机GT;
#指令。

#更改为侦听特定的IP地址,如下所示
#prevent阿帕奇从glomming到所有绑定的IP地址。

#Listen 12.34.56.78:80
听80#
#动态共享对象(DSO)支持

#为了能够使用其建成一个DSO你模块的功能
#必须把相应的`的LoadModule'线在这个位置使
其中包含的#指令实际可用_before_使用它们。
静态编译模块(在httpd -l列出)不需要
在此装载#。

#示例:
#的LoadModule foo_module模块/ mod_foo.so

的LoadModule authn_file_module的libexec / apache2的/ mod_authn_file.so
#LoadModule authn_dbm_module的libexec / apache2的/ mod_authn_dbm.so
#LoadModule authn_anon_module的libexec / apache2的/ mod_authn_anon.so
#LoadModule authn_dbd_module的libexec / apache2的/ mod_authn_dbd.so
#LoadModule authn_socache_module的libexec / apache2的/ mod_authn_socache.so
的LoadModule authn_core_module的libexec / apache2的/ mod_authn_core.so
的LoadModule authz_host_module的libexec / apache2的/ mod_authz_host.so
的LoadModule authz_groupfile_module的libexec / apache2的/ mod_authz_groupfile.so
的LoadModule authz_user_module的libexec / apache2的/ mod_authz_user.so
#LoadModule authz_dbm_module的libexec / apache2的/ mod_authz_dbm.so
#LoadModule authz_owner_module的libexec / apache2的/ mod_authz_owner.so
#LoadModule authz_dbd_module的libexec / apache2的/ mod_authz_dbd.so
的LoadModule authz_core_module的libexec / apache2的/ mod_authz_core.so
#LoadModule authnz_ldap_module的libexec / apache2的/ mod_authnz_ldap.so
的LoadModule access_compat_module的libexec / apache2的/ mod_access_compat.so
的LoadModule auth_basic_module的libexec / apache2的/ mod_auth_basic.so
#LoadModule auth_form_module的libexec / apache2的/ mod_auth_form.so
#LoadModule auth_digest_module的libexec / apache2的/ mod_auth_digest.so
#LoadModule allowmethods_module的libexec / apache2的/ mod_allowmethods.so
#LoadModule file_cache_module的libexec / apache2的/ mod_file_cache.so
#LoadModule cache_module的libexec / apache2的/ mod_cache.so
#LoadModule cache_disk_module的libexec / apache2的/ mod_cache_disk.so
#LoadModule cache_socache_module的libexec / apache2的/ mod_cache_socache.so
#LoadModule socache_shmcb_module的libexec / apache2的/ mod_socache_shmcb.so
#LoadModule socache_dbm_module的libexec / apache2的/ mod_socache_dbm.so
#LoadModule socache_memcache_module的libexec / apache2的/ mod_socache_memcache.so
#LoadModule watchdog_module的libexec / apache2的/ mod_watchdog.so
#LoadModule macro_module的libexec / apache2的/ mod_macro.so
#LoadModule dbd_module的libexec / apache2的/ mod_dbd.so
#LoadModule dumpio_module的libexec / apache2的/ mod_dumpio.so
#LoadModule echo_module的libexec / apache2的/ mod_echo.so
#LoadModule buffer_module的libexec / apache2的/ mod_buffer.so
#LoadModule data_module的libexec / apache2的/ mod_data.so
#LoadModule ratelimit_module的libexec / apache2的/ mod_ratelimit.so
的LoadModule reqtimeout_module的libexec / apache2的/ mod_reqtimeout.so
#LoadModule ext_filter_module的libexec / apache2的/ mod_ext_filter.so
#LoadModule request_module的libexec / apache2的/ mod_request.so
#LoadModule include_module的libexec / apache2的/ mod_include.so
的LoadModule filter_module的libexec / apache2的/ mod_filter.so
#LoadModule reflector_module的libexec / apache2的/ mod_reflector.so
#LoadModule substitute_module的libexec / apache2的/ mod_substitute.so
#LoadModule sed_module的libexec / apache2的/ mod_sed.so
#LoadModule charset_lite_module的libexec / apache2的/ mod_charset_lite.so
#LoadModule deflate_module的libexec / apache2的/ mod_deflate.so
#LoadModule xml2enc_module的libexec / apache2的/ mod_xml2enc.so
#LoadModule proxy_html_module的libexec / apache2的/ mod_proxy_html.so
的LoadModule mime_module的libexec / apache2的/ mod_mime.so
#LoadModule ldap_module的libexec / apache2的/ mod_ldap.so
的LoadModule log_config_module的libexec / apache2的/ mod_log_config.so
#LoadModule log_debug_module的libexec / apache2的/ mod_log_debug.so
#LoadModule log_forensic_module的libexec / apache2的/ mod_log_forensic.so
#LoadModule logio_module的libexec / apache2的/ mod_logio.so
的LoadModule env_module的libexec / apache2的/ mod_env.so
#LoadModule mime_magic_module的libexec / apache2的/ mod_mime_magic.so
#LoadModule expires_module的libexec / apache2的/ mod_expires.so
的LoadModule headers_module的libexec / apache2的/ mod_headers.so
#LoadModule usertrack_module的libexec / apache2的/ mod_usertrack.so
##的LoadModule unique_id_module的libexec / apache2的/ mod_unique_id.so
的LoadModule setenvif_module的libexec / apache2的/ mod_setenvif.so
的LoadModule version_module的libexec / apache2的/ mod_version.so
#LoadModule remoteip_module的libexec / apache2的/ mod_remoteip.so
的LoadModule proxy_module的libexec / apache2的/ mod_proxy.so
的LoadModule proxy_connect_module的libexec / apache2的/ mod_proxy_connect.so
的LoadModule proxy_ftp_module的libexec / apache2的/ mod_proxy_ftp.so
的LoadModule proxy_http_module的libexec / apache2的/ mod_proxy_http.so
的LoadModule proxy_fcgi_module的libexec / apache2的/ mod_proxy_fcgi.so
的LoadModule proxy_scgi_module的libexec / apache2的/ mod_proxy_scgi.so
#LoadModule proxy_fdpass_module的libexec / apache2的/ mod_proxy_fdpass.so
的LoadModule proxy_wstunnel_module的libexec / apache2的/ mod_proxy_wstunnel.so
的LoadModule proxy_ajp_module的libexec / apache2的/ mod_proxy_ajp.so
的LoadModule proxy_balancer_module的libexec / apache2的/ mod_proxy_balancer.so
的LoadModule proxy_ex press_module的libexec / apache2的/ mod_proxy_ex press.so
#LoadModule session_module的libexec / apache2的/ mod_session.so
#LoadModule session_cookie_module的libexec / apache2的/ mod_session_cookie.so
#LoadModule session_dbd_module的libexec / apache2的/ mod_session_dbd.so
的LoadModule slotmem_shm_module的libexec / apache2的/ mod_slotmem_shm.so
#LoadModule slotmem_plain_module的libexec / apache2的/ mod_slotmem_plain.so
#LoadModule ssl_module的libexec / apache2的/ mod_ssl.so
#LoadModule dialup_module的libexec / apache2的/ mod_dialup.so
的LoadModule lbmethod_byrequests_module的libexec / apache2的/ mod_lbmethod_byrequests.so
的LoadModule lbmethod_bytraffic_module的libexec / apache2的/ mod_lbmethod_bytraffic.so
的LoadModule lbmethod_bybusyness_module的libexec / apache2的/ mod_lbmethod_bybusyness.so
#LoadModule lbmethod_heartbeat_module的libexec / apache2的/ mod_lbmethod_heartbeat.so
的LoadModule unixd_module的libexec / apache2的/ mod_unixd.so
#LoadModule heartbeat_module的libexec / apache2的/ mod_heartbeat.so
#LoadModule heartmonitor_module的libexec / apache2的/ mod_heartmonitor.so
#LoadModule dav_module的libexec / apache2的/ mod_dav.so
的LoadModule status_module的libexec / apache2的/ mod_status.so
的LoadModule autoindex_module的libexec / apache2的/ mod_autoindex.so
#LoadModule asis_module的libexec / apache2的/ mod_asis.so
#LoadModule info_module的libexec / apache2的/ mod_info.so
#LoadModule cgi_module的libexec / apache2的/ mod_cgi.so
#LoadModule dav_fs_module的libexec / apache2的/ mod_dav_fs.so
#LoadModule dav_lock_module的libexec / apache2的/ mod_dav_lock.so
#LoadModule vhost_alias_module的libexec / apache2的/ mod_vhost_alias.so
的LoadModule negotiation_module的libexec / apache2的/ mod_negotiation.so
的LoadModule dir_module的libexec / apache2的/ mod_dir.so
#LoadModule imagemap_module的libexec / apache2的/ mod_imagemap.so
#LoadModule actions_module的libexec / apache2的/ mod_actions.so
#LoadModule speling_module的libexec / apache2的/ mod_speling.so
的LoadModule userdir_module的libexec / apache2的/ mod_userdir.so
的LoadModule alias_module的libexec / apache2的/ mod_alias.so
的LoadModule rewrite_module的libexec / apache2的/ mod_rewrite.so
#LoadModule php5_module /usr/local/php5/libphp5.so
#LoadModule hfs_apple_module的libexec / apache2的/ mod_hfs_apple.so
的LoadModule php5_module的libexec / apache2的/ libphp5.so< IfModule unixd_module>

#如果你想的httpd作为一个不同的用户或组运行,则必须运行
#的httpd以root最初,它会切换。

#用户/组:用户/组运行httpd的名称(或#NUMBER)。
#它通常是很好的做法,建立一个专门的用户和组
#运行的httpd,与大多数的系统服务。

用户_www
集团_www< / IfModule>#主服务器配置

#本节中的指示成立了由'主'使用的值
#服务器,这是为了响应不是由一个处理的所有请求
#<虚拟主机>定义。这些值也为默认值
#任何<虚拟主机>容器可能会在文件中定义后面。

#所有这些指令可能会出现内部<虚拟主机>集装箱,
#在这种情况下,这些默认设置将被覆盖的
#虚拟主机被定义。
##
#的ServerAdmin:你的邮件地址,当服务器的问题,应该是
#电子邮件发送。这个地址显示在服务器生成的页面,如
#作为一个出错文档。例如[email protected]

的ServerAdmin [email protected]
#ServerName指定Apache用于识别自身的名字和端口。
#通常可以自动确定,但我们建议您指定
#它明确地启动时prevent问题。

#如果你的主机没有注册DNS名,在这里输入IP地址。

#ServerName www.example.com:80#
#拒绝访问您的服务器的文件系统的全部内容。你必须
#明确允许访问其他Web内容目录
#<名录及GT;下面块。

<目录/>
    没有的AllowOverride
    要求所有被拒绝
< /目录>#
#注意,从这一点你一定要明确允许
#特别是功能启用 - 所以,如果事情不工作的
#你所期望的,请确保您已专门启用它
#以下。
##
#的DocumentRoot:目录外面,你会为你的
#文件。默认情况下,所有的请求都从这里开始,但
#符号链接和别名可用于指向其他位置。

的DocumentRoot/库/ Web服务器/文档
<目录/库/ Web服务器/文件>
    #
    在Options指令#可能的值是无,全部,
    #或任意组合:
    #指标包括了FollowSymLinks SymLinksifOwnerMatch ExecCGI多视图
    #
    #注意,多视图必须显式的指定---所有选项
    #它不给你。
    #
    #Options指令既复杂又重要。请参见
    #http://httpd.apache.org/docs/2.4/mod/core.html#options
    # 了解更多信息。
    #
    有FollowSymLinks在Multiviews指数
    MultiviewsMatch任何    #
    #设置AllowOverride控制那些被放置在.htaccess文件。
    #它可以是全部,无,或关键字的任意组合:
    #设置AllowOverride FileInfo的AuthConfig极限
    #
    所有的AllowOverride    #
    #控制谁可以从服务器获得资料。
    #
    要求所有批准
< /目录>#
#DirectoryIndex的:它设置Apache将服务如果一个目录中的文件
#请求。

< IfModule dir_module>
    的DirectoryIndex index.html的
< / IfModule>#
#以下行prevent的.htaccess和htpasswd文件被
#Web客户端查看。

< FilesMatch^ \\([HH] [Tt的] | [日] [SS] _ [SS])。>
    要求所有被拒绝
< / FilesMatch>#
#苹果具体文件系统的保护。

<文件RSRC>
    要求所有被拒绝
< /文件>
&所述; DirectoryMatch&GT* \\ \\ namedfork。
    要求所有被拒绝
< / DirectoryMatch>#
#错误日志:错误日志文件的位置。
#如果没有指定&LT内的ErrorLog指令,虚拟主机>
#集装箱,与该虚拟主机的错误信息会
#记录在这里。如果你做* *定义一个℃的错误日志文件,虚拟主机>
#集装箱,该主机的错误会被那里,没有记录在这里。

错误日志/私营/无功/日志/的Apache2 / error_log中#
#LogLevel的:控制记录在error_log中的消息的数量。
#可能的值包括:调试,信息,通知,警告,错误,暴击,
#警报,EMERG。

LOGLEVEL警告< IfModule log_config_module>
    #
    #下面的指令定义格式别名搭配使用
    #CustomLog指令(见下文)。
    #
    的LogFormat%H%L%U%T \\%r \\%> S%B \\%{Referer的}​​ I \\\\%{用户代理} I \\组合拳
    的LogFormat%H%L%U%T \\%r \\%>%B的共同    < IfModule logio_module>
      #您需要启用mod_logio.c使用%I和%氧
      的LogFormat%H%L%U%T \\%r \\%> S%B \\%{Referer的}​​ I \\\\%{用户代理} I \\%I%Ocombinedio
    < / IfModule>    #
    #访问日志(通用日志文件格式)的位置和格式。
    #如果你没有定义&LT内的任何访问日志文件;虚拟主机>
    #容器,它们将被记录在这里。反之,如果你做* *
    #定义per-<虚拟主机>访问日志文件,交易将是
    #记录在其中并没有*在这个文件*。
    #
    的CustomLog/私营/无功/日志/的Apache2 /访问日志共同    #
    #如果preFER访问,代理和referer信息,日志文件
    #(合并日志文件格式),可以使用下面的指令。
    #
    #CustomLog/私营/无功/日志/的Apache2 /访问日志结合
< / IfModule>< IfModule alias_module>
    #
    #重定向:允许你告诉客户有关使用文件
    #在你的服务器的命名空间存在,但不是现在。客户端
    #将在新位置的文档的新要求。
    #示例:
    #重定向常任/美孚http://www.example.com/bar    #
    #别名:地图网络路径到文件系统路径,用于
    #不DocumentRoot的生活下访问内容。
    #示例:
    #别名/ webpath /全/文件系统/路径
    #
    #如果你有一个尾随/上/ webpath则服务器将
    #要求它是在URL present。你也有可能
    #需要提供<名录及GT;部分,以允许访问
    #文件系统路径。    #
    #ScriptAlias​​指令:该控制哪个目录包含服务器脚本。
    #ScriptAlias​​es是基本上相同别名,除了
    在目标目录#文件被视为应用和
    #由服务器时请求,而不是作为发送到文档上运行
    #客户端。尾部的规则/适用于ScriptAlias​​指令
    #指令为别名。
    #
    ScriptAlias​​Match ^ / cgi-bin目录/(((我?!?的WebObjects))* $)/库/ Web服务器/ CGI-可执行文件/ $ 1< / IfModule>< IfModule cgid_module>
    #
    #ScriptSock:在线程服务器,指定路径UNIX
    #插槽用于mod_cgid的CGI守护进程进行通信。
    #
    #Scriptsock cgisock
< / IfModule>#
#/库/ Web服务器/ CGI-可执行文件应改为你的ScriptAlias​​ed
#CGI目录存在,如果有配置。

<目录/库/ Web服务器/ CGI-可执行文件>
    设置AllowOverride无
    选择无
    要求所有批准
< /目录>< IfModule mime_module>
    #
    #TypesConfig指向包含映射从列表的文件
    #文件扩展名的MIME类型。
    #
    TypesConfig /private/etc/apache2/mime.types    #
    #将AddType允许您添加或覆盖的MIME配置
    在TypesConfig特定的文件类型指定#文件。
    #
    #AddType应用程序/ x-gzip的.tgz的
    #
    #AddEncoding允许你有一定的浏览器uncom preSS
    #动态信息。注:并非所有浏览器都支持这一点。
    #
    #AddEncoding幽浮preSS .Z
    #AddEncoding的X gzip的。广州.tgz的
    #
    #如果AddEncoding指令以上是注释掉,那么你
    #也许应该确定这些扩展指示媒体类型:
    #
    将AddType应用程序/ x-COM preSS .Z
    将AddType应用程序/ x-gzip的。广州.tgz的    #
    #的AddHandler允许你某些文件扩展名映射到处理程序:
    #行动无关的文件类型。这些既可以内置在服务器
    #或Action指令增加(见下文)
    #
    #要使用CGI脚本ScriptAlias​​ed指令之外:
    #(你还需要为ExecCGI添加到选项指令。)
    #
    #AddHandler CGI脚本的CGI    #对于类型映射(协商资源):
    #AddHandler型地图变种    #
    #过滤器允许你来之前,发送到客户端处理的内容。
    #
    #要解析的.shtml服务器端包含(SSI)文件:
    #(你还需要添加包括到选项指令。)
    #
    #AddType的text / html的.shtml
    #AddOutputFilter INCLUDES的.shtml
< / IfModule>#
#mod_mime_magic模块,允许服务器使用来自各种提示
该文件本身的#内容以确定其类型。该MIMEMagicFile
#指令告诉那里的提示定义所在的模块。

#MIMEMagicFile /私人的/ etc /的Apache2 /魔法#
#可定制的错误响应有三种类型:
#1)纯文本2)本地重定向3)外部重定向

# 一些例子:
#ErrorDocument 500的服务器提出了布布。
#ErrorDocument 404 /missing.html
#ErrorDocument 404/cgi-bin/missing_handler.pl
#ErrorDocument 402 http://www.example.com/subscription_info.html
##
#MaxRanges:在之前的请求范围的最大数量
#返回整个资源,或是特殊的一个
#值默认,无或无限。
#默认设置是接受200范围。
#MaxRanges无限#
#EnableMMAP和EnableSendfile:在支持它的系统​​,
#内存映射或sendfile的系统调用可用于递送
#文件。这通常提高服务器性能,但必须
#从网络安装发球时被关闭
#文件系统,或者对于这些功能的支持,否则是
#打破了你的系统上。
#默认值:EnableMMAP开,EnableSendfile关闭

#EnableMMAP关闭
#EnableSendfile上TraceEnable关闭#补充配置

#在/私人的/ etc / apache2的/额外/目录中的配置文件可以
#包括添加额外的功能或修改的默认配置
#服务器,或者你可能只是在这里复制它们的内容,并更改为
#必要的。#服务器池的管理(MPM专用)
包括/private/etc/apache2/extra/httpd-mpm.conf#多语言错误信息
#INCLUDE /private/etc/apache2/extra/httpd-multilang-errordoc.conf#花式目录列表
包括/private/etc/apache2/extra/httpd-autoindex.conf# 语言设定
#INCLUDE /private/etc/apache2/extra/httpd-languages​​.conf#用户主目录
包括/private/etc/apache2/extra/httpd-userdir.conf请求和配置#实时信息
#INCLUDE /private/etc/apache2/extra/httpd-info.conf#虚拟主机
#INCLUDE /private/etc/apache2/extra/httpd-vhosts.conf#本地访问Apache HTTP服务器手册
#INCLUDE /private/etc/apache2/extra/httpd-manual.conf#分布式创作和版本控制(WebDAV)
#INCLUDE /private/etc/apache2/extra/httpd-dav.conf#各个默认设置
#INCLUDE /private/etc/apache2/extra/httpd-default.conf#配置mod_proxy_html理解HTML4 / XHTML1
< IfModule proxy_html_module>
包括/private/etc/apache2/extra/proxy-html.conf
< / IfModule>#安全(SSL / TLS)连接
#INCLUDE /private/etc/apache2/extra/httpd-ssl.conf

#注:以下条件必须要present支持
#没有SSL开始与没有的/ dev /随机相当于平台
#但是静态编译-mod_ssl中。

< IfModule ssl_module>
SSLRandomSeed启动内置
SSLRandomSeed内置连接
< / IfModule>#INCLUDE /private/etc/apache2/other/*.conf#
#注释出下面故意处理用户代理
#对滥用DNT(DNT *必须违反了开放标准*是一个特定的
#最终用户的选择)

#< IfModule setenvif_module>
#BrowserMatchMSIE 10.0; bad_DNT
#< / IfModule>
#< IfModule headers_module>
#RequestHeader未设置DNT ENV = bad_DNT
#< / IfModule>

我的配置:

 <目录/用户/尼/网站/>
  所有的AllowOverride
  选择多视图索引了FollowSymLinks
  要求所有批准
< /目录>


解决方案

您必须在 /etc/apache2/httpd.conf 下面的配置,才能有PHP工作:

 的LoadModule php5_module的libexec / apache2的/ libphp5.so
将AddType应用/ X的httpd - PHP的.php

这是运行后须藤apachectl中重启和PHP应该开始工作。请注意,文件 /usr/libexec/apache2/libphp5.so 必须是present为好。

Not sure if this question applies to SO so don't yell at me if it doesn't...

I've gotten rid of XAMPP and trying to do everything in os x. I followed many guides but I'm stuck on enabling PHP to work, browser does not display the phpinfo. I'm on 10.10, Apache/2.4.9, PHP 5.5.14.

I have enabled the modules in the conf file, I get to the "localhost/~me/" page, showing me the directory. My index.php file contains <?php phpinfo(); ?>, but it just outputs raw code instead of the info. Main guide I have been this following is . If there is any additional info needed, please let me know and I'll provide. Every guide has ended here where the info is supposed to be shown...any idea why it's not working?

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# will be interpreted as '/logs/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/usr"

#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:/private/var/run

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module libexec/apache2/mod_authn_file.so
#LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
#LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
#LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
#LoadModule authn_socache_module libexec/apache2/mod_authn_socache.so
LoadModule authn_core_module libexec/apache2/mod_authn_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache2/mod_authz_user.so
#LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
#LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
#LoadModule authz_dbd_module libexec/apache2/mod_authz_dbd.so
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
#LoadModule authnz_ldap_module libexec/apache2/mod_authnz_ldap.so
LoadModule access_compat_module libexec/apache2/mod_access_compat.so
LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
#LoadModule auth_form_module libexec/apache2/mod_auth_form.so
#LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
#LoadModule allowmethods_module libexec/apache2/mod_allowmethods.so
#LoadModule file_cache_module libexec/apache2/mod_file_cache.so
#LoadModule cache_module libexec/apache2/mod_cache.so
#LoadModule cache_disk_module libexec/apache2/mod_cache_disk.so
#LoadModule cache_socache_module libexec/apache2/mod_cache_socache.so
#LoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so
#LoadModule socache_dbm_module libexec/apache2/mod_socache_dbm.so
#LoadModule socache_memcache_module libexec/apache2/mod_socache_memcache.so
#LoadModule watchdog_module libexec/apache2/mod_watchdog.so
#LoadModule macro_module libexec/apache2/mod_macro.so
#LoadModule dbd_module libexec/apache2/mod_dbd.so
#LoadModule dumpio_module libexec/apache2/mod_dumpio.so
#LoadModule echo_module libexec/apache2/mod_echo.so
#LoadModule buffer_module libexec/apache2/mod_buffer.so
#LoadModule data_module libexec/apache2/mod_data.so
#LoadModule ratelimit_module libexec/apache2/mod_ratelimit.so
LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so
#LoadModule ext_filter_module libexec/apache2/mod_ext_filter.so
#LoadModule request_module libexec/apache2/mod_request.so
#LoadModule include_module libexec/apache2/mod_include.so
LoadModule filter_module libexec/apache2/mod_filter.so
#LoadModule reflector_module libexec/apache2/mod_reflector.so
#LoadModule substitute_module libexec/apache2/mod_substitute.so
#LoadModule sed_module libexec/apache2/mod_sed.so
#LoadModule charset_lite_module libexec/apache2/mod_charset_lite.so
#LoadModule deflate_module libexec/apache2/mod_deflate.so
#LoadModule xml2enc_module libexec/apache2/mod_xml2enc.so
#LoadModule proxy_html_module libexec/apache2/mod_proxy_html.so
LoadModule mime_module libexec/apache2/mod_mime.so
#LoadModule ldap_module libexec/apache2/mod_ldap.so
LoadModule log_config_module libexec/apache2/mod_log_config.so
#LoadModule log_debug_module libexec/apache2/mod_log_debug.so
#LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
#LoadModule logio_module libexec/apache2/mod_logio.so
LoadModule env_module libexec/apache2/mod_env.so
#LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
#LoadModule expires_module libexec/apache2/mod_expires.so
LoadModule headers_module libexec/apache2/mod_headers.so
#LoadModule usertrack_module libexec/apache2/mod_usertrack.so
##LoadModule unique_id_module libexec/apache2/mod_unique_id.so
LoadModule setenvif_module libexec/apache2/mod_setenvif.so
LoadModule version_module libexec/apache2/mod_version.so
#LoadModule remoteip_module libexec/apache2/mod_remoteip.so
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
LoadModule proxy_fcgi_module libexec/apache2/mod_proxy_fcgi.so
LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
#LoadModule proxy_fdpass_module libexec/apache2/mod_proxy_fdpass.so
LoadModule proxy_wstunnel_module libexec/apache2/mod_proxy_wstunnel.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
LoadModule proxy_express_module libexec/apache2/mod_proxy_express.so
#LoadModule session_module libexec/apache2/mod_session.so
#LoadModule session_cookie_module libexec/apache2/mod_session_cookie.so
#LoadModule session_dbd_module libexec/apache2/mod_session_dbd.so
LoadModule slotmem_shm_module libexec/apache2/mod_slotmem_shm.so
#LoadModule slotmem_plain_module libexec/apache2/mod_slotmem_plain.so
#LoadModule ssl_module libexec/apache2/mod_ssl.so
#LoadModule dialup_module libexec/apache2/mod_dialup.so
LoadModule lbmethod_byrequests_module libexec/apache2/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module libexec/apache2/mod_lbmethod_bytraffic.so
LoadModule lbmethod_bybusyness_module libexec/apache2/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_heartbeat_module libexec/apache2/mod_lbmethod_heartbeat.so
LoadModule unixd_module libexec/apache2/mod_unixd.so
#LoadModule heartbeat_module libexec/apache2/mod_heartbeat.so
#LoadModule heartmonitor_module libexec/apache2/mod_heartmonitor.so
#LoadModule dav_module libexec/apache2/mod_dav.so
LoadModule status_module libexec/apache2/mod_status.so
LoadModule autoindex_module libexec/apache2/mod_autoindex.so
#LoadModule asis_module libexec/apache2/mod_asis.so
#LoadModule info_module libexec/apache2/mod_info.so
#LoadModule cgi_module libexec/apache2/mod_cgi.so
#LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
#LoadModule dav_lock_module libexec/apache2/mod_dav_lock.so
#LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
LoadModule negotiation_module libexec/apache2/mod_negotiation.so
LoadModule dir_module libexec/apache2/mod_dir.so
#LoadModule imagemap_module libexec/apache2/mod_imagemap.so
#LoadModule actions_module libexec/apache2/mod_actions.so
#LoadModule speling_module libexec/apache2/mod_speling.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
#LoadModule php5_module        /usr/local/php5/libphp5.so
#LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so
LoadModule php5_module        libexec/apache2/libphp5.so

<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User _www
Group _www

</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. [email protected]
#
ServerAdmin [email protected]

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options FollowSymLinks Multiviews Indexes
    MultiviewsMatch Any

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
    Require all denied
</FilesMatch>

#
# Apple specific filesystem protection.
#
<Files "rsrc">
    Require all denied
</Files>
<DirectoryMatch ".*\.\.namedfork">
    Require all denied
</DirectoryMatch>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "/private/var/log/apache2/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "/private/var/log/apache2/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "/private/var/log/apache2/access_log" combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock cgisock
</IfModule>

#
# "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/Library/WebServer/CGI-Executables">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig /private/etc/apache2/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile /private/etc/apache2/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
#EnableSendfile on

TraceEnable off

# Supplemental configuration
#
# The configuration files in the /private/etc/apache2/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# Server-pool management (MPM specific)
Include /private/etc/apache2/extra/httpd-mpm.conf

# Multi-language error messages
#Include /private/etc/apache2/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
Include /private/etc/apache2/extra/httpd-autoindex.conf

# Language settings
#Include /private/etc/apache2/extra/httpd-languages.conf

# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include /private/etc/apache2/extra/httpd-info.conf

# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include /private/etc/apache2/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include /private/etc/apache2/extra/httpd-dav.conf

# Various default settings
#Include /private/etc/apache2/extra/httpd-default.conf

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include /private/etc/apache2/extra/proxy-html.conf
</IfModule>

# Secure (SSL/TLS) connections
#Include /private/etc/apache2/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

#Include /private/etc/apache2/other/*.conf

#
# uncomment out the below to deal with user agents that deliberately
# violate open standards by misusing DNT (DNT *must* be a specific
# end-user choice)
#
#<IfModule setenvif_module>
#BrowserMatch "MSIE 10.0;" bad_DNT
#</IfModule>
#<IfModule headers_module>
#RequestHeader unset DNT env=bad_DNT
#</IfModule>

my config:

<Directory "/Users/denis/Sites/">
  AllowOverride All
  Options Indexes MultiViews FollowSymLinks
  Require all granted
</Directory>
解决方案

You must have the following configuration in /etc/apache2/httpd.conf in order to have PHP working:

LoadModule php5_module libexec/apache2/libphp5.so
AddType application/x-httpd-php .php

After that run sudo apachectl restart and PHP should start working. Note that the file /usr/libexec/apache2/libphp5.so must be present as well.

这篇关于优山美地的Apache,PHP信息页面未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 18:23