Will enabling XDebug on a production server make PHP slower?

Yes, debuggers like XDebug reduce the performance of the PHP server. This is the reason why debuggers are not placed in server environment. They are deployed in a different environment to avoid unnecessary overheads.

Debug messages can’t be displayed in an application that is already in the production phase.

When debugging behavior is added to the server, the debug engine gets attached to the PHP process. It starts to receive messages to stop at breakpoint, but this is not the required behavior, since it introduces a high-performance blow to other processes thereby stopping the PHP parser.

On the other hand, when a debugger is installed, they tend to open ports in the server, since they are not intended to be used in production environments.

Opening ports in the server is as bad as opening a door for a hacker to snoop around.