我按照以下步骤在 Ubuntu 12.04 本地主机上安装了 php、mysql、phpmyadmin:
我尝试以下步骤:
sudo apt-get install apache2
sudo /etc/init.d/apache2 restart
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install php5-cli
sudo apt-get install php5-cgi
sudo apt-get install php5-mysql
sudo apt-get install php5-pgsql
sudo /etc/init.d/apache2 restart
在我遇到 phpmyadmin 未找到错误并使用以下答案修复之后
升级 php 和 apache 后,如何解决 phpmyadmin 未找到问题?
应用该修复程序后,我收到另一条错误消息:
Forbidden You don't have permission to access /phpmyadmin on this server.
如何修复此问题?
答案1
它解决了:
sudo apt-get install mysql-server
sudo dpkg-reconfigure phpmyadmin
sudo service apache2 restart
答案2
您需要使用以下命令更改权限:
sudo chown -R $USER:$USER /var/www/
sudo chmod -R 755 /var/www
答案3
您应该检查
/etc/apache2
并找到以下几行:<Directory /usr/share> AllowOverride None Require all granted </Directory>
apache2 配置应该有这一行:
Include /etc/phpmyadmin/apache.conf
您的 phpadmin 配置如下所示:
Alias /phpmyadmin /usr/share/phpmyadmin <Directory /usr/share/phpmyadmin> Options FollowSymLinks DirectoryIndex index.php <IfModule mod_php5.c> AddType application/x-httpd-php .php php_flag magic_quotes_gpc Off php_flag track_vars On php_flag register_globals Off php_admin_flag allow_url_fopen Off 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/javascript/ </IfModule> </Directory> <Directory /usr/share/phpmyadmin/setup> <IfModule mod_authn_file.c> AuthType Basic AuthName "phpMyAdmin Setup" AuthUserFile /etc/phpmyadmin/htpasswd.setup </IfModule> Require valid-user </Directory> <Directory /usr/share/phpmyadmin/libraries> Order Deny,Allow Deny from All </Directory> <Directory /usr/share/phpmyadmin/setup/lib> Order Deny,Allow Deny from All </Directory>
答案4
我在 Ubuntu OS 16.04 中安装 PHPMyAdmin 时遇到了这个问题。我通过在目录部分添加行 [Require all grant] 解决了该问题。
例子:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>