Score:2

After upgrading my little cloud server, my webpage won't start and phpmyadmin won't start

es flag

After running do-release-upgrade on my little cloud server, my webpage won't work and phpadmin will not start. Upgrade was from 20.04 Server to 22.04 Server. The upgrade ended successfully. I can ssh into the server

When I enter my webpage address, I see the contents of the index.php, but that's all.

<?php
 // don't forget the / before the file name!! VIP VIP VIP DO NOT FORGET THE /  ï¼ï¼
//include $_SERVER['DOCUMENT_ROOT'] . '/startfile.html.php';
header('location: startfile.html.php')
?>

but I don't get my startfile.html.php. Everything worked fine before the upgrade!

Also, I can't access phpmyadmin, I just see this in stead of the login page:

<?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 can access the server via ssh.

There is an error in the apache2 mydomain.error.log which says it cannot stat mydomain/public_html/wp-login.php

I have no idea why it is looking for wp-login.php I never had such a file.

Why won't my index.php open my startfile.html.php?

I can access mysql from the command line as a normal, non-root user.

Organic Marble avatar
us flag
Just a hint because I don't use php - I've seen similiar posts on this site and IIRC the problem was a change of the php version. Try searching this site.
raj avatar
cn flag
raj
"When I enter my webpage address, I see the contents of the index.php". Do you see the **literal** PHP code that you posted in the question? That means that your web server is not passing the *.php files to PHP to be executed, but just displays them as if they were HTML. Somewhere in your Apache configuration was previously an `AddHandler` or `SetHandler` directive for `.php` files that is now missing. You must locate the place and put it back there.
Pedroski avatar
es flag
Yes, I agree, PHP is not working, but I don't know why not. I use this webpage for for homework and classwork. The webpages all have a PHP timer at the top, If a student tries to open a webpage too early or too late, PHP redirects to a webpage which shows a JS clock and a message "You are too early, or too late". Now the timer is not working. I can directly open my startfile.html.php and all the classwork pages are available. I just see the PHP timer as text at the top of the webpage.
Score:1
es flag

Half the problem solved:

In /etc/apache2/mods-enabled both php7.4 and php8.1 had entries:

php7.4.load and php7.4.conf php8.1.load and php8.1.conf

php7.4 is not installed. But I think apache2 was trying to load the php7.4 modules

I renamed them php7.4.load.old and php7.4.conf.old

Now I can open phpmyadmin in my browser, so half the problem solved.

Still trying to figure out why PHP is not working as far as the webpages are concerned!

Now the webpage is working: I put this in /etc/apache2/apache2.conf

<Directory /var/www/*>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

Before I only had this below, which is from William Desportes, recommended to me here, but it restricted the opening of files in /var/www/

<Directory />
        Options SymLinksIfOwnerMatch
        DirectoryIndex index.php
        #AllowOverride None
        #Require all denied
        # limit libapache2-mod-php to files and directories necessary by pma
        # PHP 8+
        <IfModule mod_php.c>
                php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
                php_admin_value open_basedir /var/www/:/usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
        </IfModule>
</Directory>

The error in /var/log/apache2/mydomain.com-error.log was:

[Thu Jul 13 08:39:27.883981 2023] [php:warn] [pid 6793] [client 35.167.198.156:55492] PHP Warning: Unknown: open_basedir restriction in effect. File(/var/www/mydomain.com/public_html/index.php) is not within the allowed path(s): (/usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/) in Unknown on line 0

All seems to be working now!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.