Ошибка 404 phpmyadmin apache

Has anyone had problems with 404 errors and phpmyadmin after upgrading to Apache 2.4?

My ubuntu machine ran the upgrade a few days ago and I have not been able to access localhost/phpmyadmin since. I just get 404 errors.

I know there have been security changes in 2.4 but I checked out the settings in the phpmyadmin.conf loaded by apache and I can’t see anything that would affect non-admin users. Furthermore I commented out the old security rules and added the new ones, but still not working…

asked Aug 3, 2013 at 9:01

DatsunBing's user avatar

DatsunBingDatsunBing

8,61416 gold badges87 silver badges171 bronze badges

1

the directory of configuration files apparently changed in apahe 2.4 fron conf.d to conf-available. Also, the conf files must be loaded explicitly. I did

sudo cp /etc/apache2/conf.d/phpmyadmin.conf /etc/apache2/conf-available/

sudo a2enconf phpmyadmin 

sudo service apache2 reload

answered Oct 4, 2013 at 7:53

mmzc's user avatar

2

Here’s what I found.

The configuration file is /etc/phpmyadmin/apache.conf.

The package installer for phpMyAdmin creates a link from /etc/apache2/conf.d/phpmyadmin.conf to the configuration file.

In my case, Apache did not seem to be picking up that configuration. So I created a link in my «sites-available» folder and enabled the site:

ln -s /etc/phpmyadmin/apache.conf /etc/apache2/sites-available/phpmyadmin.conf

a2ensite phpmyadmin

Seems to be working fine now.

answered Aug 8, 2013 at 15:02

Kryten's user avatar

KrytenKryten

15.1k6 gold badges45 silver badges68 bronze badges

Ok so I found the answer with a bit of fiddling.

Basically /phpmyadmin is an alias for /usr/share/phpmyadmin This was previously defined in phpmyadmin.conf. I now have it defined in the apache2 alias.conf file, and it works fine.

Not sure if that means that I am missing out on other things defined in phpmyadmin.conf, but will have to see, I suppose.

answered Aug 4, 2013 at 5:44

DatsunBing's user avatar

DatsunBingDatsunBing

8,61416 gold badges87 silver badges171 bronze badges

Apache update probably overwrites config.

Adding include conf.d/phpmyadmin.conf to /etc/apache2/apache2.conf should fix it.

answered Dec 4, 2013 at 9:05

umpirsky's user avatar

umpirskyumpirsky

9,88213 gold badges71 silver badges96 bronze badges

Make sure you have selected your httpd server, during the installatino process. I thought I had checked apache, but I didnot.

I removed phpmyadmin and reinstall it taking care to check apache this time, and everything was automatically setted up. I was finally able to use phpmyadmin without configure anything else.

answered Jan 18, 2016 at 18:08

besrow's user avatar

I have installed php5 and phpMyAdmin from the Ubuntu Software Centre on a fresh install of Ubuntu 13.04.

when I enter localhost in my browser the following is displayed:

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

So something is working.

if I then type in localhost/phpmyadmin or localhost/phpmyadmin/index.php the page returns a 404 error page, file not found.

I created a file in /var/www called test.php with one line in it <?php phpinfo(); ?> when I try to access it through my browser, I get 403 Forbidden

This points to a permissions problem

with phpMyAdmin I also installed:

  • Apache HTTP Server metapackage (apache2)
  • Base support for JavaScript library packages (javascript-common)
  • Fast webserver with minimal memory footprint (lighttpd)
  • MySQL Client (mysql-client)
  • GD module for php5 (php5-gd)
  • MySQL Server (mysql-server)

When installing phpMyAdmin, I was not asked any questions, which I found interesting as on previous installs, I have been asked to choose a server.

The folder /etc/phpmyadmin has the following content:

  • conf.d/
  • config-db.php.ucf-dist

The folder conf.d has no content

Is there something I need to install which I haven’t or is there something I can do to fix the 404 & 403 errors?

Edit

owners in /var

:/var$ ls -lh
total 48K
drwxr-xr-x  2 root root     4.0K Jun  9 12:16 backups
drwxr-xr-x 21 root root     4.0K Jun  9 13:28 cache
drwxrwsrwt  2 root whoopsie 4.0K Jun  9 16:01 crash
drwxr-xr-x 73 root root     4.0K Jun  8 19:24 lib
drwxrwsr-x  2 root staff    4.0K Apr 19 10:03 local
lrwxrwxrwx  1 root root        9 Jun  9 16:00 lock -> /run/lock
drwxr-xr-x 20 root root     4.0K Jun  9 16:01 log
drwxrwsr-x  2 root mail     4.0K Apr 24 18:01 mail
drwxrwsrwt  2 root whoopsie 4.0K Apr 24 18:05 metrics
drwxr-xr-x  2 root root     4.0K Apr 24 18:01 opt
lrwxrwxrwx  1 root root        4 Jun  9 16:00 run -> /run
drwxr-xr-x 10 root root     4.0K Jun  8 19:41 spool
drwxrwxrwt  4 root root     4.0K Jun  9 16:25 tmp
drwxr-xr-x  2 www-data www-data     4.0K Jun  7 21:04 www

and:

...:/var$ ls -lh /var/www
total 12K
-rw-r--r-- 1 www-data www-data  177 Jun  7 20:30 index.html
-rw-r--r-- 1 www-data www-data 3.5K Jun  7 20:30 index.lighttpd.html
-rw-r--r-- 1 www-data www-data   20 Jun  7 21:04 test.php
-rw-r--r-- 1 www-data www-data    0 Jun  7 21:04 test.php~

on restarting the apache2 service I get the following in Terminal

simon@simon-VGN-AR71E:~$ sudo service apache2 restart
apache2: Syntax error on line 260 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf.d/phpmyadmin.conf: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
   ...fail!

i renamed phpmyadmin.conf link and ran

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf

see the broken link symbol in nautilus:

enter image description here

simon@simon-VGN-AR71E:~$ ls -lh /etc/apache2/conf.d
total 16K
-rw-r--r-- 1 root root  269 Jul 16  2012 charset
lrwxrwxrwx 1 root root   45 Jun  7 21:14 javascript-common.conf -> /etc/javascript-common/javascript-common.conf
-rw-r--r-- 1 root root 3.3K Jul 16  2012 localized-error-pages
-rw-r--r-- 1 root root  143 Jul 16  2012 other-vhosts-access-log
lrwxrwxrwx 1 root root   28 Jun  9 17:28 phpmyadmin.conf -> ../../phpmyadmin/apache.conf
-rw-r--r-- 1 root root 1.7K Jul 16  2012 security

END===================================

When phpMyAdmin tries to access URL as https://example.com/phpmyadmin/server_variables.php&filter=long_query_time, Apache throws a 404 Error.

What might be the problem?

The requested URL /phpmyadmin/server_variables.php&filter=long_query_time was not found on this server.
 Apache/2.4.27 (Ubuntu) Server at example.com Port 443

When I changed & to ?, everything worked like a charm.
My phpmyadmin.conf looks like this:

Alias /phpmyadmin "/usr/share/phpmyadmin"
<Directory "/usr/share/phpmyadmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>

.htaccess in /usr/share/phpmyadmin looks like this:

AuthType Basic
AuthName "Restricted access!"
AuthUserFile /usr/share/phpmyadmin/.htpasswd
Require valid-user

phpMyAdmin version is: 4.7.3

asked Aug 3, 2017 at 10:40

devondre's user avatar

This is completely normal, because a URL has these components with exactly these delimiters:

scheme://host:port/path?query

This means that the following URLs are completely different:

  • https://example.com/phpmyadmin/server_variables.php?filter=long_query_time

    Here, phpmyadmin/server_variables.php is path and filter=long_query_time query. Apache can find server_variables.php and pass the variables of this GET method query to PHP.

  • https://example.com/phpmyadmin/server_variables.php&filter=long_query_time

    This one has only path, phpmyadmin/server_variables.php&filter=long_query_time. Because there’s no such file, Apache shows error 404, as it is supposed to do.

The & is, instead, used as a delimiter between variables inside a query, e.g. ?foo=123&bar=456.

answered Aug 3, 2017 at 11:16

Esa Jokinen's user avatar

Esa JokinenEsa Jokinen

45.2k2 gold badges81 silver badges129 bronze badges

6

answered Aug 6, 2017 at 12:48

devondre's user avatar

There are a few common problems that people run into after installing LAMP on Ubuntu. In this post I’ll show how to fix a few of those problems. If you don’t already have LAMP set up, please see How To Install LAMP on Ubuntu.

Fixing phpMyAdmin

One common error that some people make is that they forget to mark apache2 during the phpMyAdmin configuration. When this happens you’ll get a 404 Not Found error when trying to navigate to http://localhost/phpmyadmin/.

phpMyAdmin Not Found

If this happens, enter the following terminal command.

sudo dpkg-reconfigure phpmyadmin

You will be prompted about reinstalling the database. Accept the default of «No» and hit <Enter>.

Don't reinstall phpMyAdmin database

Make sure to then mark apache2 by having the cursor next to apache2 and then hitting <Space> to mark it with a *, then hit <Enter>.

Reconfigure phpMyAdmin for Apache

You will then need to reload Apache.

sudo service apache2 reload

You should now be able to load http://localhost/phpmyadmin/. If you’re still seeing the 404 Not Found error, then you will need to clear your web browser cache and try again.

phpMyAdmin login screen

Click to enlarge

Fixing the Apache fully qualified domain name

During the above steps you may have seen an error message like this when reloading Apache.

apache2: Could not reliably determine the server's fully qualified domain name,
using 127.0.1.1 for ServerName

This doesn’t seem to cause any problems for me, but if you don’t like seeing that error, you can fix it with this command.

echo «ServerName localhost» | sudo tee /etc/apache2/conf.d/fqdn

Then reload Apache with

sudo service apache2 reload

Remove LAMP?

Is your LAMP setup a mess and you just want to start over? Follow these instructions to Remove LAMP from Ubuntu.

So, you tried to access phpmyadmin and got ‘phpMyAdmin Error 404 Page Not Found’ or ‘page not found’?

phpmyadmin 404 solution

This is real nasty thing and irritates nearly everyone. To have it working properly is must for every webmaster. So, let’s see what you can do.

This error appears when you try to access phpMyAdmin control panel / dashboard using domain or IP address in this way;

mydomain.com/phpmyadmin

OR

127.0.0.1/phpmyadmin

This problem is mostly caused due to improper directives or misconfiguration in Apache. It doesn’t happen with every server and apache config. Just some are prone to it.

Method 1: Configuring Directives

1. Connect to your server using SSH (Putty etc).
2. Now, copy-paste this command;

sudo nano /etc/httpd/conf/httpd.conf

3. This file contains all the directives needed for a server to redirect, process or identify different name based servers etc.

4. Go to end of this configuration file. Most probably you will find configuration of your server. If not then find your virtual server host configuration and copy-paste the following;

Alias /phpmyadmin '/var/www/html/phpmyadmin/'

<Directory /var/www/html/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_value include_path .
</IfModule>
</Directory>

5. Now restart the httpd (apache) by using command;

sudo service httpd restart

6. Try to access phpMyAdmin control panel using domain or IP in this fashion;

domain.com/phpmyadmin

7. You must see the phpMyAdmin Login page.

8. Done!

If this doesn’t work out for you then you must reconsider the path of Apache config file. Different OS have different locations and also different commands to restart the services.

One more but old method was to symlink the httpd configuration. This may work on older servers, Ubuntu OS and other apache versions.

Method 2: Symlinking

1. Connect to VPS, server etc and type this;

 sudo dpkg-reconfigure -plow phpmyadmin

2. You will have option to select Apache webserver to configure. Select it as per your domain.

3.  If above fails then you can directly copy-paste the following;

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
sudo /etc/init.d/apache2 reload

This will symlink the config files.

4. Now try to access the phpMyAdmin. You shall not get 404 Error Page Not Found.

Done! Comments and issues are welcome as always.

If this or other problem persist. You may want to review your installation of phpMyAdmin, MySQL, Apache or PHP here.

For other errors and troubleshooting of phpMyAdmin, read this article.

Enjoy!

Понравилась статья? Поделить с друзьями:
  • Ошибка 404 page not found
  • Ошибка 404 not found что это значит
  • Ошибка 404 not found перевод
  • Ошибка 404 not found nginx
  • Ошибка 404 nginx как исправить