【问题标题】:NGINX not loading PHP inside phpmyadminNGINX 没有在 phpmyadmin 中加载 PHP
【发布时间】:2019-02-12 07:45:32
【问题描述】:

问题

我目前有一个简单的 PHP 页面,在 localhost/info.php 上正确显示 phpinfo()。但是,当尝试通过输入“localhost/phpmyadmin”打开 phpmyadmin 时,它给了我这个:

我什至不介意我是否必须输入“localhost/phpmyadmin/index.php”才能使其工作,但这甚至不起作用。它基本上有相同的弹出窗口,但询问我是否要下载 PHP 文件:

我尝试了各种 nginx 配置,但下面的配置让我走到了这一步。任何帮助将不胜感激。


当前设置

  • PHP 7.2.7
  • nginx 1.15.0
  • 迅奔图18.04

nginx.conf

server {
    listen 80;
    listen [::]:80;

    root /var/www/;

    index index.php index.html index.htm index.nginx-debian.html;

    server_name bacon.com;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ [^/]\.php(/|$) {  
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME 
        $document_root$fastcgi_script_name;
    }

    location ~ /\.ht {
        deny all;
    } 
}

【问题讨论】:

    标签: php nginx phpmyadmin


    【解决方案1】:

    如果你配置错误,一旦你的浏览器缓存将保留它,而不管之后的配置是否正确...清除缓存并且它起作用了!

    【讨论】:

      猜你喜欢
      • 2019-08-08
      • 2018-12-10
      • 1970-01-01
      • 1970-01-01
      • 2021-06-27
      • 2021-04-04
      • 1970-01-01
      • 2015-08-16
      • 1970-01-01
      相关资源
      最近更新 更多