0

hello i know there are a lot of questions talking about this problem but the thing is i installed apache2 and mysql and php 7.3 but when i try to enter localhost/phpmyadmin it shows

?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Main loader script
 *
 * @package PhpMyAdmin
 */
use PhpMyAdmin\Charsets;
use PhpMyAdmin\Config;
use PhpMyAdmin\Core;
use PhpMyAdmin\Display\GitRevision;
use PhpMyAdmin\LanguageManager;
use PhpMyAdmin\Message;
use PhpMyAdmin\RecentFavoriteTable;
use PhpMyAdmin\Relation;
use PhpMyAdmin\Response;
use PhpMyAdmin\Sanitize;
use PhpMyAdmin\Server\Select;
use PhpMyAdmin\ThemeManager;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
use PhpMyAdmin\UserPreferences;

/**
 * Gets some core libraries and displays a top message if required
 */
require_once 'libraries/common.inc.php';

/**
 * pass variables to child pages
 */
$drops = array(
    'lang',
    'server',
    'collation_connection',
    'db',
    'table'
);
foreach ($drops as $each_drop) {
    if (array_key_exists($each_drop, $_GET)) {
        unset($_GET[$each_drop]);
    }
}
unset($drops, $each_drop);

/*
 * Black list of all scripts to which front-end must submit data.
 * Such scripts must not be loaded on home page.
 *
 */
$target_blacklist = array (
    'import.php', 'export.php'
);

// If we have a valid target, let's load that script instead
if (! empty($_REQUEST['target'])
    && is_string($_REQUEST['target'])
    && ! preg_match('/^index/', $_REQUEST['target'])
    && ! in_array($_REQUEST['target'], $target_blacklist)
    && Core::checkPageValidity($_REQUEST['target'], [], true)
) {
    include $_REQUEST['target'];
    exit;
}

if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
    exit;
}.....etc

it is a long code so i won't include it all unless you ask to what happened with me is after installing all of Lamp services i entered php my admin and then it threw not found so i included this line inside the apache config

Include /etc/phpmyadmin/apache.conf

and then this happened

ubuntu version : Ubuntu 20.04 LTS i downloaded it as Desktop

how i installed LAMP https://medium.com/better-programming/how-to-install-lamp-stack-on-ubuntu-db77ac018116

but note that not everything worked perfectly there were some errors and i had to check other resources and i entered many websites and tried a lot of stuff before coming here so my environment might be missy if you suggest reinstalling all please guide me through the process

Update : i have php 7.4.3 installed but i think it is not enabled and when i try

a2enmod php7.4

it throws

Considering dependency mpm_prefork for php7.4:
Considering conflict mpm_event for mpm_prefork:
ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first!
Considering conflict mpm_worker for mpm_prefork:
ERROR: Could not enable dependency mpm_prefork for php7.4, aborting

php cli is 7.4.3 apache log

[Mon Apr 27 06:04:22.301065 2020] [mpm_event:notice] [pid 7212:tid 140619563371584] AH00489: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Apr 27 06:04:22.301385 2020] [core:notice] [pid 7212:tid 140619563371584] AH00094: Command line: '/usr/sbin/apache2'
[Mon Apr 27 06:05:42.547129 2020] [mpm_event:notice] [pid 7212:tid 140619563371584] AH00491: caught SIGTERM, shutting down
[Mon Apr 27 06:06:08.849938 2020] [mpm_event:notice] [pid 8424:tid 140393719311424] AH00489: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Apr 27 06:06:08.850056 2020] [core:notice] [pid 8424:tid 140393719311424] AH00094: Command line: '/usr/sbin/apache2'
[Mon Apr 27 06:08:59.234468 2020] [mpm_event:notice] [pid 8424:tid 140393719311424] AH00493: SIGUSR1 received.  Doing graceful restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 27 06:08:59.242099 2020] [mpm_event:notice] [pid 8424:tid 140393719311424] AH00489: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Apr 27 06:08:59.242111 2020] [core:notice] [pid 8424:tid 140393719311424] AH00094: Command line: '/usr/sbin/apache2'
[Mon Apr 27 06:09:07.878703 2020] [mpm_event:notice] [pid 8424:tid 140393719311424] AH00491: caught SIGTERM, shutting down
[Mon Apr 27 15:40:17.496415 2020] [mpm_event:notice] [pid 971:tid 140557889219648] AH00489: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Apr 27 15:40:17.549391 2020] [core:notice] [pid 971:tid 140557889219648] AH00094: Command line: '/usr/sbin/apache2'

about the phpinfotest it shows the source code

there is no such file like this /etc/apache2/site-available/your_vhost.conf

what i have similar to this is /etc/apache2/sites-available/000-default.conf

4
  • Please edit and tell - Which Ubuntu version, desktop/server - How installed 'all of Lamp services' (phpmyadmin should run from scratch when installed from offcicial repo/packages)
    – cmak.fr
    Apr 26, 2020 at 18:40
  • done waiting for your reply
    – RYOK
    Apr 26, 2020 at 19:17
  • Does this answer your question? PHP script not executing on Apache server
    – karel
    Apr 27, 2020 at 1:25
  • you should revert what you did in the step 4 of the tutorial you followed. Simply install php with apt-get install -y php and reconfigure phpmyadmin - For the future, you may prefer official documentation...
    – cmak.fr
    Apr 27, 2020 at 5:55

4 Answers 4

3

Ubuntu 20:

Since you do not give enough info to fix your problem. You probably simply need to reinstall php:

sudo apt install --reinstall php

If the Apache worker is still wrong, do this:

sudo systemctl stop apache2
sudo a2dismod mpm_event
sudo a2enmod php7.4

Ubuntu 22:

As of this write-up, the Ubuntu repository install script for phpmyadmin will NOT install libapache2-mod-phpX.X as a dependency which is needed to process PHP under Apache. It will install Apache as a dependency, but not the needed module.

It will also install PHP to some extent (php -v works), but "full" PHP install is not complete.

To fix this (before, or after phpmyadmin install):

sudo apt install php

It will offer to install "libapache2-mod-php8.1" & "php8.1" which phpmyadmin failed at. (Or, whatever version is currently being used under Ubuntu 22.) Once the module is installed, reload server: sudo systemctl restart apache2 and try phpmyadmin again.

0

You need to check PHP, your Host, your Vhost, your Apache logs

Check your CLI

php -v

Check your Apache logs

sudo tail -n 20 /var/log/apache2/error.log

Check PHP inside your browser (localhost/test.php) using phpinfo()

sudo nano /var/www/html/test.php

paste this code inside the test.php

<?php echo phpinfo(); ?>

and check if it loads in web browser.

Check your localhost or your new local domain name:

cat /etc/hosts

Check your Vhost

vim /etc/apache2/site-available/your_vhost.conf

If all it's ok try to check if your phpmyadmin is enabled

sudo a2ensite you_vhost.conf

And important after enabled mod or site ... restart or reload apache

sudo systemctl reload apache2.service
sudo systemctl restart apache2.service
2
  • i will edit my post with these inforimation
    – RYOK
    Apr 27, 2020 at 12:46
  • Note: Default Ubuntu 22 install for phpMyAdmin will NOT install libapache2-mod-php8.1 which is needed to process PHP under Apache. It WILL install php to some extent, but current repo installer forgot the apache mod. Just run: sudo apt install php (before or after phpmyadmin install). Fixed.
    – B. Shea
    Dec 28, 2022 at 19:11
0

Simple option check,

php -v 

You will get the error, as in my case error was

"PHP Startup: Unable to load dynamic library 'mbstring.so' for php 8.1. "

So I have run and install

sudo apt install php8.1-mbstring

and now I am able see the UI of phpmyadmin

-1

I fixed this by uninstalling all of apache2 , mysql , phpmyadmin , php

using synaptic package manager you can install it using this link

https://dev.to/xeroxism/how-to-install-synaptic-package-manager-in-ubuntu-linux-hm3and

after uninstalling all of the components i followed this guy's tutorial

https://www.youtube.com/watch?v=TNwCGttYrlM

and if the terminal through package not found then you look at the error and fix the problem then do as the video suggests and phpmyadmin will work with you if it said that phpmyadmin not found when you enter http://localhost/phpmyadmin

then you should edit to this file

sudo nano /etc/apache2/apache2.conf

and add this line in anyplace like line 79 of any line you find empty

Include /etc/phpmyadmin/apache.conf

save it and restart apache

sudo service apache2 restart

Hope this help anyone in the future and good luck

3
  • 1
    Installing another package-manager doesn't seem like a stable solution to me.
    – Jeppe
    Aug 7, 2022 at 19:16
  • (-1) The problem w/ adding 3rd party links is they eventually all go to 404/not founds. LAMP installs do not need to be explained either - it's like an answer on 'how do I install apache'. Well documented already here. In future, if u insist on adding add links, use them near end of answer only as refs. You are the one writing an answer - not links. Adding as comment to question would have been best in this case. All you really needed to say is, "I did a complete LAMP purge and reinstall and that fixed it.". As I mentioned in my answer, all u probably needed to do was 'reinstall' PHP, though.
    – B. Shea
    Jul 10, 2023 at 13:58
  • Also: I have NEVER needed to edit the files you mention to simply get phpmyadmin working. And you shouldn't either. The phpmyadmin include is not needed. It's already setup under /etc/apache2/conf-enabled/phpmyadmin.conf if installed correctly. Also: You can barely read this answer. You don't use periods. I would fix/edit it, but I honestly have no idea what you mean in some parts.
    – B. Shea
    Jul 10, 2023 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .