【求助】apache2.4.20解析php

回复 收藏
本帖最后由 拉卡 于 2016-7-23 19:06 编辑

新搭的一个环境:
CentOS 6.5 x64
mysql:5.7.13
httpd:2.4.20
php:7.0.0

目前环境运行正常,httpd、mysqld、php-fpm服务均正常启动
默认网站打开也会显示“It's Work!”
但是不能解析php文件
httpd.conf中已添加相关配置:
blob.png


httpd.conf配置文件如下:(过滤了部分#开头的行)
-----------------------------------------------------------------------
ServerRoot "/usr/local/apache2"

Listen 80
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php7_module        modules/libphp7.so

User daemon
Group daemon


ServerAdmin you@example.com
ServerName www.example.com:80

    AllowOverride None
    Require all denied


DocumentRoot "/usr/local/apache2/htdocs"

    #
    # 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 Indexes FollowSymLinks
    #
    # 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


    DirectoryIndex index.html index.htm index.php


    Require all denied

ErrorLog "logs/error_log"
LogLevel warn

    #
    # 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
   
      # 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
   
    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per- access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "logs/access_log" common
    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access_log" combined

    #
    # 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  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.
    #
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

    AllowOverride None
    Options None
    Require all granted

Include conf/extra/proxy-html.conf

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

---------------------------------------------------------------
现在curl localhost/1.php  结果如下:
14.png

附上apache已加载的模块:
1.png


希望有大腿帮我分析下问题!!  谢谢!!!




2016-07-23 18:12 举报
已邀请:
0

阿铭 管理员

赞同来自:

参考一下这个吧  http://jingyan.baidu.com/artic ... .html  我觉得你的php模块并没有正确安装。
0

拉卡

赞同来自:

非常感谢铭哥,唉,话说我也是问了度娘的,为啥度娘的回答你的跟我的差距这么大呢?

根据那篇帖子,现在php已经能成功解析,主要原因就是 php7模块没加载到。谢谢!

再次感谢!

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: