在 PHP7 Apache/2.4.7 (Ubuntu) 上安装 phpmyadmin 时遇到问题

2022-01-05 00:00:00 php php-7 phpmyadmin

我今天安装了 PHP7

I installed PHP7 today with

sudo add-apt-repository ppa:ondrej/php-7.0
sudo apt-get install php7.0-cli php7.0-common libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-fpm

此后,当我尝试访问 phpmyadmin 时出现 403 禁止错误.然后我尝试用

after this, I got 403 forbidden error when I tried to access phpmyadmin. then I tried to reinstall phpmyadmin with

apt-get install phpmyadmin

但它仍然寻找不再存在的php5依赖项:

but it still looks for php5 dependencies which arent there anymore:

我该怎么做才能解决这个问题?

what can I do to solve this?

推荐答案

通过 wget 安装并在 Apache 中创建别名.跟踪:

Install it via wget and create an alias in Apache. Keep track:

切换到目录/usr/share:

cd /usr/share

更改为 root 用户:

Change to root user:

 sudo su

下载 phpMyAdmin:

Download phpMyAdmin:

wget https://files.phpmyadmin.net/phpMyAdmin/4.5.4.1/phpMyAdmin-4.5.4.1-all-languages.zip

解压:(可以先安装解压)

Unzip it: (you may install unzip first)

unzip phpMyAdmin-4.5.4.1-all-languages.zip

重命名文件夹:

mv phpMyAdmin-4.5.4.1-all-languages phpmyadmin

更改权限:

chmod -R 0755 phpmyadmin

配置 apache 以便它可以正确找到它:

Configure apache so that it can find it correctly:

vim /etc/apache2/sites-available/000-default.conf

在DocumentRoot/var/www/html"之后的任何地方插入以下行:

Anywhere after "DocumentRoot /var/www/html" insert these line:

Alias /phpmyadmin "/usr/share/phpmyadmin/"
<Directory "/usr/share/phpmyadmin/">
     Order allow,deny
     Allow from all
     Require all granted
</Directory>

重启 Apache:

service apache2 restart

你准备好了!

刚刚从我当前的安装中截取了一个屏幕截图供您验证它是否有效.

Just took a screenshot from my current installation for you to validate it works.

相关文章