Pgadmin4 - 500 內部伺服器錯誤

Pgadmin4 - 500 內部伺服器錯誤

我是 PostgreSQL 的新用戶。我在 CentOS 8 伺服器上安裝了 PostgreSQL 13,並在 Web UI 和桌面 UI 模式下設定了 PGAdmin4。安裝成功,桌面 UI 工作正常,但當我嘗試存取 Web UI 時收到以下錯誤:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache 和 PostgreSQL 服務運作良好。 Apache 和 PostgreSQL 服務及其連接埠已在防火牆中允許。

[root@XXXXXX-testing-server ~]# ss -tulpn | grep 5432
tcp   LISTEN 0      128           0.0.0.0:5432       0.0.0.0:*    users:(("postmaster",pid=1485,fd=6))                    
tcp   LISTEN 0      128              [::]:5432          [::]:*    users:(("postmaster",pid=1485,fd=7))                    
[root@XXXXXX-testing-server ~]#

我檢查過/var/log/httpd/error_log。我可以在 Apache 服務日誌中看到以下錯誤。

[Fri Sep 08 15:31:38.438903 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] mod_wsgi (pid=2114): Failed to exec Python script file '/usr/pgadmin4/web/pgAdmin4.wsgi'.
[Fri Sep 08 15:31:38.439004 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] mod_wsgi (pid=2114): Exception occurred processing WSGI script '/usr/pgadmin4/web/pgAdmin4.wsgi'.
[Fri Sep 08 15:31:38.443337 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] Traceback (most recent call last):
[Fri Sep 08 15:31:38.443412 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/web/pgAdmin4.wsgi", line 36, in <module>
[Fri Sep 08 15:31:38.443417 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     from pgAdmin4 import app as application
[Fri Sep 08 15:31:38.443424 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/web/pgAdmin4.py", line 104, in <module>
[Fri Sep 08 15:31:38.443427 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     app = create_app()
[Fri Sep 08 15:31:38.443432 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/web/pgadmin/__init__.py", line 550, in create_app
[Fri Sep 08 15:31:38.443435 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     driver.init_app(app)
[Fri Sep 08 15:31:38.443441 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/web/pgadmin/utils/driver/__init__.py", line 27, in init_app
[Fri Sep 08 15:31:38.443444 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     DriverRegistry.load_modules(app)
[Fri Sep 08 15:31:38.443459 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/web/pgadmin/utils/driver/registry.py", line 20, in load_modules
[Fri Sep 08 15:31:38.443461 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     from . import psycopg3 as module
[Fri Sep 08 15:31:38.443468 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/web/pgadmin/utils/driver/psycopg3/__init__.py", line 21, in <module>
[Fri Sep 08 15:31:38.443471 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     import psycopg
[Fri Sep 08 15:31:38.443476 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/venv/lib64/python3.9/site-packages/psycopg/__init__.py", line 9, in <module>
[Fri Sep 08 15:31:38.443479 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     from . import pq  # noqa: F401 import early to stabilize side effects
[Fri Sep 08 15:31:38.443484 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/venv/lib64/python3.9/site-packages/psycopg/pq/__init__.py", line 114, in <module>
[Fri Sep 08 15:31:38.443487 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     import_from_libpq()
[Fri Sep 08 15:31:38.443492 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]   File "/usr/pgadmin4/venv/lib64/python3.9/site-packages/psycopg/pq/__init__.py", line 106, in import_from_libpq
[Fri Sep 08 15:31:38.443495 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963]     raise ImportError(
[Fri Sep 08 15:31:38.443509 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] ImportError: no pq wrapper available.
[Fri Sep 08 15:31:38.443511 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] Attempts made:
[Fri Sep 08 15:31:38.443515 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] - couldn't import psycopg 'c' implementation: /usr/pgadmin4/venv/lib64/python3.9/site-packages/psycopg_c/pq.cpython-39-x86_64-linux-gnu.so: undefined symbol: PQpipelineStatus
[Fri Sep 08 15:31:38.443518 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] - couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary'
[Fri Sep 08 15:31:38.443520 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] - couldn't import psycopg 'python' implementation:

但上面提到的 Python 庫/套件已經在我的伺服器中可用。

[root@XXXXXXXX-testing-server ~]# pip3.6 install psycopg2-binary 
Requirement already satisfied: psycopg2-binary in /usr/local/lib64/python3.6/site-packages (2.9.7)

這個錯誤是什麼原因造成的?

相關內容