Plesk: passing the authorization headers in PHP when running with FastCGI/mod_fcgid

When you try to pass authorization headers via PHP to provide a login interface, you’ll notice it doesn’t work when running it with FastCGI enabled in Plesk by default. It does work with the standard mod_php Apache module for PHP.

The solution is to add the following directive to your Apache configuration in Plesk. Add this to the /var/www/vhosts/[DOMAIN]/conf/vhost.conf file.

FcgidPassHeader     Authorization

And run the Plesk Reconfigurator so it knows to include that vhost.conf file in the Apache configs.

# /usr/local/psa/admin/bin/websrvmng -av

Test your config:

# service httpd configtest

Syntax error on line 7 of /var/www/vhosts/[DOMAIN]/conf/vhost.conf:

Invalid command ‘FcgidPassHeader’, perhaps misspelled or defined by a module not included in the server configuration

But that doesn’t work. That’s because Plesk starts with its own implementation of the FastCGI and not the “normal” one.

rpm -qa | grep ‘fcgid’#

psa-mod_fcgid-1.10-3

The solution is as simple as installing the regular mod_fcgid to replace it.

# yum install mod_fcgid

And your list should look similar to this.

# rpm -qa | grep fcgid

psa-mod_fcgid-1.10-3

mod_fcgid-2.3.5-2.el5.art

And the configtest will now work.

# service httpd configtest

Syntax OK

The extra FastCGI parameter is now being included as it should and will pass along the Authorization headers via PHP.