PHPMyAdmin 下载索引文件而不是在网页中打开它

PHPMyAdmin 下载索引文件而不是在网页中打开它

所以我刚刚通过 apt 下载了 phpmyadmin。当我尝试在 Web 浏览器中打开它时,它下载了索引文件而不是执行它。我已经在 Google 上搜索了大约 2 小时,找到的每个答案都是你没有启用 php。问题是,我启用了。我正在运行另一个 PHP 网站,那个网站运行良好。任何帮助都将不胜感激!

  • PHP 版本 7.4
  • Apache 版本 2.4.29
  • PHPMyAdmin apache 配置:
Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
   Options SymLinksIfOwnerMatch
   DirectoryIndex index.php

   <IfModule mod_php5.c>
       <IfModule mod_mime.c>
           AddType application/x-httpd-php .php
       </IfModule>
       <FilesMatch ".+\.php$">
           SetHandler application/x-httpd-php
       </FilesMatch>

       php_value include_path .
       php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
       php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
       php_admin_value mbstring.func_overload 0
   </IfModule>
   <IfModule mod_php.c>
       <IfModule mod_mime.c>
           AddType application/x-httpd-php .php
       </IfModule>
       <FilesMatch ".+\.php$">
           SetHandler application/x-httpd-php
       </FilesMatch>

       php_value include_path .
       php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
       php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
       php_admin_value mbstring.func_overload 0
   </IfModule>

</Directory>

# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
   <IfModule mod_authz_core.c>
       <IfModule mod_authn_file.c>
           AuthType Basic
           AuthName "phpMyAdmin Setup"
           AuthUserFile /etc/phpmyadmin/htpasswd.setup
       </IfModule>
       Require valid-user
   </IfModule>
</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
   Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
   Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
   Require all denied
</Directory>

如果您需要更多信息,请询问,我会添加。

编辑: 禁用 Apache 后问题仍然存在

相关内容