librespeed / speedtest

Self-hosted Speed Test for HTML5 and more. Easy setup, examples, configurable, mobile friendly. Supports PHP, Node, Multiple servers, and more
https://librespeed.org
GNU Lesser General Public License v3.0
11.52k stars 2.12k forks source link

Mysql database cannot save test results. #466

Open tianzanl opened 2 years ago

tianzanl commented 2 years ago

Description

I use dockerfile to package and deploy the project, but the mysql configuration I set has never taken effect, and no data is saved to the database during speed measurement.I hope to get your help to solve this problem, thanks.

Server

mysql version: 8.0.27 Browser: Google Chrome 98.0.4758.82 OS: Ubuntu 18.04 docker version: 20.10.6 Dockerfile:

FROM adolfintel/speedtest:latest
ENV MODE standalone
ENV TELEMETRY true
ENV ENABLE_ID_OBFUSCATION true
ENV WEBPORT 80
ENV PASSWORD 123456
ENV DB_TYPE mysql
ENV DB_USERNAME root
ENV DB_PASSWORD root
ENV DB_HOSTNAME 192.168.1.205
ENV DB_NAME speedtest
ENV DB_PORT 3306

Steps to reproduce

1.Deploy the dockerfile packaged project. 2.Enter the container to view the configuration file.The configuration seems to be correct. image 3.No results are saved to the database after the speed test. image image

Expected behaviour

I want the results to be saved to the mysql database after the speed test.

adolfintel commented 2 years ago

Sorry for the late reply,

Open F12>Network, run the test, and check the response from telemetry.php, it should give us a clue about this problem.

Roadwen commented 2 years ago

I have the same problem,it shows there is no response. Wait for your help.

image

tianzanl commented 2 years ago

Sorry for the late reply,

Open F12>Network, run the test, and check the response from telemetry.php, it should give us a clue about this problem. speedtest1 speedtest2

alexdelprete commented 2 years ago

Same problem here with mariadb. If I switch to sqlite it works.

In telemetry_db.php I noticed the port and dbname in dsn config lines commented, or is the ";" a concatenation character?

image

adolfintel commented 2 years ago

The semicolons are normal, it's not a comment.

Can you check apache's error.log file? It might tell us something.

alexdelprete commented 2 years ago

In /var/log/apache2 of the container there's only a couple of symlinks:

root@2eec01ccaabd:/var/log/apache2# ls -al
total 8
drwxrwxrwx 2 www-data www-data 4096 Mar  1 20:20 .
drwxr-xr-x 1 root     root     4096 Mar  1 20:20 ..
lrwxrwxrwx 1 www-data www-data   11 Mar  1 20:20 access.log -> /dev/stdout
lrwxrwxrwx 1 www-data www-data   11 Mar  1 20:20 error.log -> /dev/stderr
lrwxrwxrwx 1 www-data www-data   11 Mar  1 20:20 other_vhosts_access.log -> /dev/stdout

So I checked the container log after I've done 1 test:

+ echo 'Done, Starting APACHE'
+ apache2-foreground
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.26.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.26.0.2. Set the 'ServerName' directive globally to suppress this message
[Sat Mar 12 15:54:39.935510 2022] [mpm_prefork:notice] [pid 26] AH00163: Apache/2.4.52 (Debian) PHP/7.4.28 configured -- resuming normal operations
[Sat Mar 12 15:54:39.935794 2022] [core:notice] [pid 26] AH00094: Command line: 'apache2 -D FOREGROUND'
172.26.0.1 - - [12/Mar/2022:15:55:08 +0100] "GET / HTTP/1.1" 200 3829 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:08 +0100] "GET /speedtest.js HTTP/1.1" 200 5082 "https://librespeed.domain.dom/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:08 +0100] "GET /favicon.ico HTTP/1.1" 200 17205 "https://librespeed.domain.dom/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /speedtest_worker.js?r=0.9320212639465417 HTTP/1.1" 200 8059 "https://librespeed.domain.dom/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/getIP.php?isp=true&distance=km&r=0.20111704236622496 HTTP/1.1" 200 386 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.7468258793609552 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.246148312144715 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.6349097651643245 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.7175129848260553 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.5948712292282443 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.6756004705451175 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.2840548139258101 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.18961713685935688 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.21960404517207444 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:10 +0100] "GET /backend/empty.php?r=0.7927047919146231 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:11 +0100] "GET /backend/garbage.php?r=0.1663728767568664&ckSize=100 HTTP/1.1" 200 104859047 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:12 +0100] "GET /backend/garbage.php?r=0.24129589633705906&ckSize=100 HTTP/1.1" 200 58816532 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:11 +0100] "GET /backend/garbage.php?r=0.7222316677753517&ckSize=100 HTTP/1.1" 200 86290738 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:12 +0100] "GET /backend/garbage.php?r=0.9302450916829175&ckSize=100 HTTP/1.1" 200 47728906 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:12 +0100] "GET /backend/garbage.php?r=0.3828675383172788&ckSize=100 HTTP/1.1" 200 35769406 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
127.0.0.1 - - [12/Mar/2022:15:55:18 +0100] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.52 (Debian) PHP/7.4.28 (internal dummy connection)"
127.0.0.1 - - [12/Mar/2022:15:55:19 +0100] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.52 (Debian) PHP/7.4.28 (internal dummy connection)"
172.26.0.1 - - [12/Mar/2022:15:55:19 +0100] "POST /backend/empty.php?r=0.09583093660168696 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:20 +0100] "POST /backend/empty.php?r=0.0611934668728078 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:20 +0100] "POST /backend/empty.php?r=0.3416539730181487 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:22 +0100] "POST /backend/empty.php?r=0.41059329442267223 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:22 +0100] "POST /backend/empty.php?r=0.9924868049447773 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:22 +0100] "POST /backend/empty.php?r=0.37545549453838367 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:24 +0100] "POST /backend/empty.php?r=0.49378989655639804 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:24 +0100] "POST /backend/empty.php?r=0.2763264592677055 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:24 +0100] "POST /backend/empty.php?r=0.1624742826745742 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:27 +0100] "POST /backend/empty.php?r=0.3506928092247774 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:27 +0100] "POST /backend/empty.php?r=0.3607895304900848 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:27 +0100] "POST /backend/empty.php?r=0.5188574697701742 HTTP/1.1" 200 332 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
172.26.0.1 - - [12/Mar/2022:15:55:27 +0100] "POST /results/telemetry.php?r=0.5663423041705689 HTTP/1.1" 200 308 "https://librespeed.domain.dom/speedtest_worker.js?r=0.9320212639465417" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4884.0 Safari/537.36 Edg/100.0.1181.0"
127.0.0.1 - - [12/Mar/2022:15:55:32 +0100] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.52 (Debian) PHP/7.4.28 (internal dummy connection)"

This is the only output of telemetry.php from Edge devtools, response is empty, I can only show the payload:

image

adolfintel commented 2 years ago

Sorry for the late reply again, but I'm super busy lately.

Can you enter the container and make a new php file that contains <?phpinfo()?> and show me the output?

alexdelprete commented 2 years ago

Sure, I can. But a new php file that contains what exactly? If you give me details I can do it.

adolfintel commented 2 years ago

Oh, github must have removed it

<?php phpinfo(); ?>
alexdelprete commented 2 years ago

The output was huge, I exported it in pdf, attached.

phpinfo.pdf

photomatix18 commented 2 years ago

I'm having this same problem. I'm using Linuxserver's docker image.

enrik90h commented 2 years ago

I solved in my lab, installing php-pdo_mysql on librespace Docker Image. "apk add php-pdo_mysql"

alexdelprete commented 2 years ago

So there's a missing module in the image?

enrik90h commented 2 years ago

@alexdelprete Apparently, yes.

Dean-Rodgers commented 1 year ago

I having the same issue with mysql database i.e. there is no persistence.

Is anyone able to provide steps necessary to fix the issue. I see above that installing php-pdo_mysql on librespeed Docker Image might help.

@enrik90h are you able to provide some of the steps that you took please?

davidancalagon commented 1 year ago

Have there been any updates on this? I've been having the same issue while trying to use an external mysql database and would really love to have it resolved.

smyoss commented 1 year ago

Hey folks, same issue here. Any idea on when we might be able to use an external MySQL db? It would be great if the missing module could be added to the docker image. Thank you so much!!

pnwbob commented 9 months ago

Sqlite works for me, but mariadb using the mysql setting doesn't. I've tried running apk add php-pdo_mysql and it still doesn't work for me

ianr2 commented 5 months ago

Same issue on a mariadb, nothing saved

2EyeTec commented 3 months ago

Error message on results: missing db connector (apt install php-mysql, libapache2-mod-php) Open myurl.tld/results/telemetry.php in your browser, if it shows an ID, its working Check results page again, there should be your result, just without any data. Use an index.html which supports Telemetry (original index.html) to store results. If you're missing the image for sharing, you have to install PHP GD (apt install php-gd)

hth

sstidl commented 3 months ago

This is a very old issue from the time before the new docker image. I didn't test all the databases, so please tell me, if there is a problem with the latest docker image.