Important: Please read the Qt Code of Conduct -

qt.qpa.xcb could not connect to display

  • I'm using gnuplot (which apparently uses QT) on ubuntu 20.04
    gnuplot is being executed in a php module.
    If I run the php at the command line it runs fine, very quickly and generates the graphics I'm expecting. However this module is intended to be run on a webserver.
    On Apache the same module takes several minutes to run and generates these error messages in the Apache error log:

    Warning: slow font initialization
    Could not connect to existing gnuplot_qt. Starting a new one.
    qt.qpa.xcb: could not connect to display 
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

    Do you have any ideas on what's happening and how I can correct it?
    Best regards,

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The use of the xcb plugin requires an Xorg server to be active which you likely do not have on your server. One way to make it work would be to use the offscreen backend.

  • @SGaist Hi thanks for this proposal but how do I do it?
    Best regards,

  • Lifetime Qt Champion

    Either by passing the -platform argument to your application or using the QT_QPA_PLATFORM environment variable.

Log in to reply