phpmyadmin / docker

Docker container for phpMyAdmin
https://hub.docker.com/_/phpmyadmin
GNU General Public License v3.0
675 stars 455 forks source link

phpmyadmin:fpm not working #390

Closed kenpachizero closed 1 year ago

kenpachizero commented 2 years ago

Hi All, i have tried to get some help on docker forums but was not able to find a want to get it to work so trying my luck here: nginx-172.31.255.226-81:81-82:82 nginx_etc /etc/nginx nginx_log /var/log/nginx phpma_html /var/www/pma mariadb-172.31.255.229-3306:3306 /var/lib/mysql phpmyadmin-172.31.255.228-9000:9000 phpma_etc | /etc/phpmyadmin phpma_html | /var/www/html

and here is my nginx config file currently

server {
        listen 82;
        server_name _;
    index index.php;
        root /var/www/pma;
    access_log /var/log/nginx/access/phpmyadmin82.log;
        error_log /var/log/nginx/error/phpmyadmin82.log debug;

location ^~ / {
try_files $uri = 404;
location ~ \.php$ {
fastcgi_pass 172.31.255.228:9000;
include /etc/nginx/params/fastcgi.conf;
                             }
                       }
             }

fastcgi.conf

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $request_filename;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;
fastcgi_param  PATH_INFO       $fastcgi_path_info;

Please let me know if i missed something, thanks in advanced.

williamdes commented 2 years ago

Hi Can you post your docker-compose file?

kenpachizero commented 2 years ago

Hi i used portainer to set this up so i dont have a docker compose file but let me know what you are after and i'll post it. Some of the info you are after might be in that link to the docker forums

kenpachizero commented 1 year ago

ok, so i tried to work with wordpress since it goes through fpm as well and i got it to work with this config

server {
    listen 83;
    server_name _;
root /var/www/wordpress;
index index.php;

access_log /var/log/nginx/access/wordpress.log;
error_log /var/log/nginx/error/wordpress.log debug;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 172.31.255.253:9000;
fastcgi_index index.php;
include /etc/nginx/params/fastcgi.conf;
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

so i tried a similar config

server {
    listen 82;
    server_name _;
root /var/www/pma;
index index.php;

access_log /var/log/nginx/access/pma.log;
error_log /var/log/nginx/error/pma.log debug;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 172.31.255.228:9000;
fastcgi_index index.php;
include /etc/nginx/params/fastcgi.conf;
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

but get the error: "502 Bad Gateway"

williamdes commented 1 year ago

Are the two containers on the same network?

kenpachizero commented 1 year ago

Hi William, Yes they are on the same 172.31.255.* network

williamdes commented 1 year ago

Hi William, Yes they are on the same 172.31.255.* network

What does nginx/fpm container logs say? It's strange

kenpachizero commented 1 year ago

2022/12/13 00:27:45 [error] 23#23: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.17, server: _, request: "GET / HTTP/1.1", upstream: "http://172.31.255.228:8081/", host: "192.168.0.43:82"

Im not sure where the 8081 is coming from

kenpachizero commented 1 year ago

found the 8081 and removed it its loading to some degree:

Fatal error: Uncaught ErrorException: mysqli::real_connect(): (HY000/2002): No route to host in /var/www/html/libraries/classes/Dbal/DbiMysqli.php:122 Stack trace: #0 [internal function]: PhpMyAdmin\ErrorHandler->handleError(2, 'mysqli::real_co...', '/var/www/html/l...', 122) #1 /var/www/html/libraries/classes/Dbal/DbiMysqli.php(122): mysqli->real_connect('172.31.255.235', 'root', 'xxxx', '', 0, '', 0) #2 /var/www/html/libraries/classes/DatabaseInterface.php(1877): PhpMyAdmin\Dbal\DbiMysqli->connect('root', 'VMfrSo1mzN0LO7M...', Array) #3 /var/www/html/libraries/classes/Common.php(604): PhpMyAdmin\DatabaseInterface->connect(256) #4 /var/www/html/libraries/classes/Common.php(233): PhpMyAdmin\Common::connectToDatabaseServer(Object(PhpMyAdmin\DatabaseInterface), Object(PhpMyAdmin\Plugins\Auth\AuthenticationConfig)) #5 /var/www/html/index.php(40): PhpMyAdmin\Common::run() #6 {main} thrown in /var/www/html/libraries/classes/Dbal/DbiMysqli.php on line 122
kenpachizero commented 1 year ago

fixed that, i have put in the config file 2 maria db servers and they both weren't running, but its loading now,!