#Standalone External Web Server PHP Error #90035

1 messages · Page 1 of 1 (latest)

sly steppe
#

Hello there. I'm currently running a Minecraft server in the cloud with Dynmap and its running into a PHP error with my external standalone NGINX web server when it attempts to connect to the MySQL database. My NGINX web server and MySQL database are both running on another server within the same internal network as the Minecraft server in the cloud, though they're both separate from one another. I also have the prerequisite php7.4-fpm and php-mysqli packages installed for the web server in order to be able to interact with the Dynmap plugin. I have my logs posted below. The MySQL auth user and networking all seems good. This might be an issue with Dynmap's MySQL code? I'm unsure.

configuration.txt - https://pastebin.com/BLdGcx92

2023/06/17 20:54:42 [error] 90035#90035: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to a member function bind_param() on bool in /var/www/dynmap/web/standalone/MySQL_funcs.php:44
Stack trace:
#0 /var/www/dynmap/web/standalone/MySQL_funcs.php(67): getStandaloneFileByServerId()
#1 /var/www/dynmap/web/standalone/MySQL_configuration.php(22): getStandaloneFile()
#2 {main}
  thrown in /var/www/dynmap/web/standalone/MySQL_funcs.php on line 44" while reading response header from upstream, client: <redacted>, server: <redacted>,
 request: "GET /standalone/MySQL_configuration.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "<redacted>", referrer: "<redacted>"
bold pikeBOT
#

Thank you! Please provide any errors you are experiencing and upload your configuration.txt. Someone from our <@&801354402010628138> team will respond to help shortly. As a general reminder, everyone on our support team is a volunteer, please be kind!

#

(optional) Please upload your configuration.txt to https://pastebin.org and send us the link. BE SURE TO REMOVE PASSWORDS

sly steppe
#

The Minecraft server can connect to the external MySQL database just fine as well. I have not been able to get it to populate anything yet though, as the web server cannot connect back to its MySQL database for Dynmap. The web server can access the MySQL database just fine otherwise though.

chrome onyx
#

Can you send the full error.log? The informative lines are not there in your snippet

sly steppe
#

Where would that error.log file be located? The snippet is from the nginx error.log file. I will see if I can locate it.

chrome onyx
#

That one yes, /var/log/nginx/error.log

sly steppe
#

The /var/log/nginx/error.log file is empty. The snippet included everything from my web server's custom error.log.

From /etc/nginx/site-available/custom.conf:

    error_log  /var/log/nginx/dynmap.app-error.log error;
chrome onyx
#

Oh, then use that one :)

sly steppe
#

Okay. One moment please. :)

#

Almost there, need to SCP the file real quick

#

I'm connected over SSH atm

chrome onyx
#

Table 's2_voidcraft.dynStandaloneFiles' doesn't exist in

sly steppe
chrome onyx
#

Your user probably doesn't have the required permissions

sly steppe
#

The two images listed above display the database and grant permissions

chrome onyx
#

Is the webserver accessing on localhost?

sly steppe
#

Yes.

#

It's connecting over a Unix socket

chrome onyx
#

I don't think those are the same, but not sure

sly steppe
#

Hmmmmm

chrome onyx
#

Try to change localhost to % and see if it then can create the table

#

Assuming you have a firewall to block external connections

sly steppe
#

Inside of MySQL_config.php? The firewall has a proper allow rule to connect from the Minecraft server to the web server, those can connect together

sly steppe
chrome onyx
#

Yeah, or just the alter user / add user commands

sly steppe
#

Yeah, I will try that. One moment

chrome onyx
#

👍

sly steppe
#

Same error. I did a flush privileges and it only shows the GRANTS of USAGE for the user.

#

You'll see two users there. One for the web server and one for the Minecraft server / Pterodactyl Panel connection

#

Well, there is another for Pterodactyl Panel's own user, which connects fine to the MySQL database locally. It's running on the same server as NGINX and the MySQL database.

#

The NGINX web server receives the same PHP error:
90035#90035: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to a member function bind_param() on bool in /var/www/dynmap/web/standalone/MySQL_funcs.php:44

#

Here's the Minecraft server console on startup:

#

Ah, I see it connected now that the server is online.

#

It populated the MySQL database with the tables it needed

#

It'll just need a fullrender now, I believe

#

Strange though, I had it render tiles before, though I suppose the web server accesses the new tiles through the MySQL database rather than locally in file storage

#

I was having issues before this one with the MySQL connection until I had figured out that I required the prerequisite php7.4-fpm package and my MySQL_config.php file to have its IP address set to localhost.

#

During that time when I was troubleshooting, I had left my Minecraft offline as all I had been receiving up to that point when it was online was a server connection error from my web server.

#

It's populating the tiles now

#

directly into the MySQL database

#

Thank you for the help!

chrome onyx
#

Yes, ofcourse, the webserver has no knowledge of the filesystem of the mcserver

#

Sorry I didn't catch that

chrome onyx
sly steppe
#

When I try to use php8.1-fpm, it runs into an error. According to the wiki article, they state that the php7.4-fpm package is required for webchat and php-mysqli package is required for the mysql interface.
https://github.com/webbukkit/dynmap/wiki/[Tutorial]-Setting-up-a-standalone-web-server-with-MySQL-SQLite/#to-use-nginx-with-dynmap-you-also-need-to-install-php74-fpm-for-the-webchat-and-php-mysqli-for-the-mysql-interface
However, in the original GitHub issue #2609, that section is missing, though is heavily mentioned in the comments.
https://github.com/webbukkit/dynmap/issues/2609
I will fetch the error real quick from the web server log.

GitHub

I haven't seen any clear instructions on getting a standalone server running with MySQL/SQLite. The wiki page about how to setup the standalone web server is also out of date by a long shot. Af...

GitHub

A set of Minecraft mods that provide a real time web-based map system for various Minecraft server implementations. - webbukkit/dynmap

#

/etc/nginx/sites-available/custom.conf

    location ~ \.php$ {
#        include snippets/fastcgi-php.conf;
        fastcgi_split_path_info ^(.+?\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_PROXY "";
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

/var/log/nginx/dynmap.app-error.log

2023/06/18 01:01:18 [error] 101368#101368: *12 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught mysqli_sql_exception: No such file or directory in /var/www/dynmap/web/standalone/MySQL_funcs.php:31
Stack trace:
#0 /var/www/dynmap/web/standalone/MySQL_funcs.php(31): mysqli_connect()
#1 /var/www/dynmap/web/standalone/MySQL_funcs.php(42): initDbIfNeeded()
#2 /var/www/dynmap/web/standalone/MySQL_funcs.php(67): getStandaloneFileByServerId()
#3 /var/www/dynmap/web/standalone/MySQL_update.php(53): getStandaloneFile()
#4 {main}
  thrown in /var/www/dynmap/web/standalone/MySQL_funcs.php on line 31" while reading response header from upstream, client: <redacted>, server: <redacted>, request: "GET /standalone/MySQL_update.php?world=world&ts=1687075274398 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "map.tableofnerds.com", referrer: "<redacted>"
#

The PHP error it throws is #101368:

101368#101368: *12 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught mysqli_sql_exception: No such file or directory in /var/www/dynmap/web/standalone/MySQL_funcs.php:31
#

When it's using php8.1-fpm

#

So, I'll leave it on php7.4-fpm for now until the code is updated to support php8.1-fpm or higher. I believe the latest is php8.2 at this time.

On another note, I will leave an example MySQL_config.php configuration here for others in case they happen to stumble across a similar issue in the future.

/var/www/dynmap/web/standalone/MySQL_config.php

<?php
$dbname = 's2_voidcraft';
$dbhost = 'localhost';
$dbport = 3306;
$dbuserid = '<redacted>';
$dbpassword = '<redacted>';
$dbprefix = 'dyn';
$loginenabled = false;
?>
sly steppe
#

Is it related to this line in
/var/www/dynmap/web/standalone/config.js?
update: 'standalone/MySQL_update.php?world={world}&ts={timestamp}',

#

Here's the entire code from that file:

var config = {
 url : {
  configuration: 'standalone/MySQL_configuration.php',
  update: 'standalone/MySQL_update.php?world={world}&ts={timestamp}',
  sendmessage: 'standalone/MySQL_sendmessage.php',
  login: 'standalone/MySQL_login.php',
  register: 'standalone/MySQL_register.php',
  tiles: 'standalone/MySQL_tiles.php?tile=',
  markers: 'standalone/MySQL_markers.php?marker='
 }
};
chrome onyx
#

did you install and use that version of php?

#

try the php -version command in bash

sly steppe
#
php -version
PHP 8.2.7 (cli) (built: Jun  8 2023 15:27:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies

The php version being used by NGINX is php7.4-fpm though. I restarted its service after trying both php7.4-fpm and php8.1-fpm

chrome onyx
#

try that version, so unix:/run/php/php8.2-fpm.sock;

sly steppe
#

Yeah, that completely breaks it when using php8.2-fpm. Both php7.4-fpm and php8.1-fpm work just fine

#

I'll post the error, it's a mysqli connection issue

#

When it's running php8.2-fpm

#

/var/log/nginx/dynmap.app-error.log

2023/06/18 01:26:05 [error] 102620#102620: *90 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function mysqli_connect() in /var/www/dynmap/web/standalone/MySQL_funcs.php:31
Stack trace:
#0 /var/www/dynmap/web/standalone/MySQL_funcs.php(42): initDbIfNeeded()
#1 /var/www/dynmap/web/standalone/MySQL_funcs.php(67): getStandaloneFileByServerId()
#2 /var/www/dynmap/web/standalone/MySQL_configuration.php(22): getStandaloneFile()
#3 {main}
  thrown in /var/www/dynmap/web/standalone/MySQL_funcs.php on line 31" while reading response header from upstream, client: <redacted>, server: <redacted>,
 request: "GET /standalone/MySQL_configuration.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.2-fpm.sock:", host: "<redacted>", referrer: "<redacted>"```
#

The PHP error it gives is #102620:

102620#102620: *90 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function mysqli_connect() in /var/www/dynmap/web/standalone/MySQL_funcs.php:31
#

I am going to continue using php8.1-fpm from now on. I think the code will need to be updated to support php8.2+

chrome onyx
#

Ah, mysqli is not installed for php8.2

#

It shouldn't matter much

#

So I'd say you are fine with either 8.1 or 7.4

sly steppe
#

Ah, you were right. I did not have the newest package of php8.2-mysql installed

#

My mistake

#

I also changed back my web server user to use localhost instead of % with the following command:
UPDATE mysql.user SET Host='localhost' WHERE Host='%' AND User='<username>';

#

Works just fine. I'll try using the php8.2-fpm.sock now

chrome onyx
#

Nice!

#

We are getting there :)

sly steppe
#

Yeah, that resolved the PHP #102620 - mysqli_connect() error. Everything works great! Thank you so much! :)

chrome onyx
#

Nice! Glad I could help