Home > Software design >  I recieve a file instead of access PhpMyAdmin page
I recieve a file instead of access PhpMyAdmin page

Time:09-12

When I installed Php, PhpMyAdmin and Nginx, I recievied this file with these code file instead of access to

http://localhost:80/phpmyadmin

<?php

declare(strict_types=1);

use PhpMyAdmin\Routing;

if (! defined('ROOT_PATH')) {
    // phpcs:disable PSR1.Files.SideEffects
    define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
    // phpcs:enable
}

global $route, $containerBuilder;

require_once ROOT_PATH . 'libraries/common.inc.php';

$dispatcher = Routing::getDispatcher();
Routing::callControllerForRoute($route, $dispatcher, $containerBuilder);

I've done like this phpmyadmin 404 error in nginx to fix the 404 error but after that I've received error above. Sorry for my bad English.

CodePudding user response:

Step 1: you need to check status of nginx server with command line:

sudo service nginx status

  • If nginx server not active,try to restart nginx server with command line sudo service nginx restart
  • If you see failed, let's check what program is running on port 80 (let's me know in the comment). The common error is caused by the apache2 server running on port 80 (If this is true, go to the next step).

Step 2: The are two solution for you 1, Stop server apache2 with this commana line:

sudo service apache2 stop

Restart nginx server:

sudo service nginx restart

Check status nginx server again, it's should be ok right now. 2, Change port apache2 You need to change two file /etc/httpd/conf/httpd.conf and /etc/apache2/ports.conf

For example, I change port apache2 from 80 to 8888:

sudo nano /etc/apache2/ports.conf and change Listen 80 to Listen 8888

sudo nano /etc/apache2/ports.conf and change <VirtualHost: *:80> to <VirtualHost: *:8080>

After that, restart the apache2 server and nginx server:

  • Restart apache2 server: sudo service apache2 restart

  • Restart nginx server: sudo service nginx restart

Please leave comment if anything you want to ask.

  • Related