Wordpress behind a Web Proxy

As I spent some time to search for a solution, here a short note on running a Wordpress site behind a web proxy, like e.g. in a company network needed to access the internet (I'm not talking about a reverse proxy setup here).

A few days ago, a Wordpress setup at my company stopped installing updates. As internet access is only possible through a web proxy, I assumed that this caused the issue (already know the trouble from many other tools...).

Wordpress still displays information, that there are updates available, but install fails with the message "Download failed". I could not figure out what was going on. After some more research I found that there are two things to observe:

First, set up Wordpress by configuring the proxy server in the wp-config.php file like this:

<?php
define('WP_PROXY_HOST', 'proxy-host.company.com');
define('WP_PROXY_PORT', '3128');

# Use the following two lines, if you need to log in to the
# proxy service with username and password.
define('WP_PROXY_USERNAME', '');
define('WP_PROXY_PASSWORD', '');

# define hosts that should he accessed without proxy
define('WP_PROXY_BYPASS_HOSTS', 'localhost');

This is the easy part and described on many other websites, too. But this alone is not sufficient.

Second, the important, and in my case missing part is th following: You need to make sure, that the PHP curl module is installed on your webserver (at this time php7.2-curl), because curl is used to download plugins and updates.

It seems after an update of PHP from version 7.1 to 7.2, the curl module was not automatically installed, which caused the updated to fail.

LinkedIn logo mail logo