V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
kmdd33
V2EX  ›  程序员

centos7yum 安装 phpmyadmin 后,无法显示 phpmyadmin 和 PHP 的安装信息?在线等

  •  
  •   kmdd33 · 2018-04-13 19:04:53 +08:00 · 1496 次点击
    这是一个创建于 2176 天前的主题,其中的信息可能已经有所发展或是发生改变。

    配置环境:centos7,openresty,mariadb

    (安装背景:phpmyadmin 是 yum 安装的,php 是编译安装的)

    服务器测试地址:

    http://104.131.43.152/test.html

    http://104.131.43.152/phpmyadmin

    http://104.131.43.152/info.php

    目前服务器安装的状态:

    php -v

    PHP 7.2.4 (cli) (built: Mar 27 2018 17:23:35) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.4, Copyright (c) 1999-2018, by Zend Technologies You have new mail in /var/spool/mail/root

    mariadb 显示是激活的状态。

    nginx.conf,info.php ,test.html,错误日志等大量配置图片请看我在 sf 上发的帖子地址是: https://segmentfault.com/q/1010000014312298

    请教伙伴们的是:

    1.我输入 http://104.131.43.152/info.php 的时候,为什么这个文件会自动下载,而不是显示 php 的版本信息? test.html 可以显示里面的文本信息,但是也无法显示 php 版本信息。

    2.phpmyadmin 配置哪里出错了吗?如何在 openresty ( nginx )下,如何正确配置 phpmyadmin ?

    8 条回复    2018-04-17 10:03:39 +08:00
    julyclyde
        1
    julyclyde  
       2018-04-13 20:02:47 +08:00
    1 info.php 被下载说明你没配置好 www 服务器; test.html *当然不能* 显示 php 版本信息
    explore365
        2
    explore365  
       2018-04-14 00:53:47 +08:00
    nginx 没添加 php 的配置
    kmdd33
        3
    kmdd33  
    OP
       2018-04-14 01:27:59 +08:00
    @julyclyde 请问如何配置 www 服务器?
    @explore365 nginx 里面如何添加 php 的配置?在 nginx.conf 里面添加吗?
    kmdd33
        4
    kmdd33  
    OP
       2018-04-14 01:31:08 +08:00
    @explore365 2 位能否看下我在 sf 里面发的截图配置?谢谢。https://segmentfault.com/q/1010000014312298
    kmdd33
        5
    kmdd33  
    OP
       2018-04-14 02:07:27 +08:00
    http://104.131.43.152/info.php 目前这个显示正常了,http://104.131.43.152/phpmyadmin 还是无法显示入口
    julyclyde
        6
    julyclyde  
       2018-04-15 23:01:41 +08:00
    @kmdd33 nginx 网站上就有。你拒绝学习,我们也没办法
    Hardrain
        7
    Hardrain  
       2018-04-17 09:51:51 +08:00
    php-cli 和 php-fpm 不是一回事,nginx 需要后者,因为它能通过 FastCGI 被调用。

    此外,PHP 建议你用软件源安装,你自己编译的八成没把 FPM 编译进去;要不就是 nginx 的 server block 里压根没配置 php-fpm

    建议你检索一下"CentOS nginx PHP FPM",这问题很容易解决。
    Hardrain
        8
    Hardrain  
       2018-04-17 10:03:39 +08:00
    还是给你个参考吧:
    1. 这个放在`server{}`这个 block 里
    此例中,PHP-FPM 监听 tcp://127.0.0.1:9000
    如使用 Unix socket,把后两行的注释反过来即可。
    ```
    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass 127.0.0.1:9000;
    #fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }
    ```
    2. {nginx_root}/snippets/fastcgi-php.conf 的内容:
    ```
    # regex to split $uri to $fastcgi_script_name and $fastcgi_path
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    # Check that the PHP script exists before passing it
    try_files $fastcgi_script_name =404;

    # Bypass the fact that try_files resets $fastcgi_path_info
    # see: http://trac.nginx.org/nginx/ticket/321
    set $path_info $fastcgi_path_info;
    fastcgi_param PATH_INFO $path_info;

    fastcgi_index index.php;
    include fastcgi.conf;
    ```
    3. {nginx_root}/fastcgi.conf 的内容:
    ```
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;

    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REQUEST_SCHEME $scheme;
    fastcgi_param HTTPS $https if_not_empty;

    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;

    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param REDIRECT_STATUS 200;
    ```

    以上是 nginx 连接 php-fpm 的方法,{nginx_root}一般是 /etc/nginx,也就是 nginx.conf 所在的目录。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5452 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 01:33 · PVG 09:33 · LAX 18:33 · JFK 21:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.