• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Enable FastCGI in Plesk 11/Centos 6.3

L

LaszloD

Guest
Hello,

I already posted here but nobody helps me there...

PRODUCT, VERSION, MICROUPDATE, OPERATING SYSTEM, ARCHITECTURE

11.0.9 Update #22, last updated at Oct 31, 2012 03:33 AM
CentOS 6.3 (Final) x86_64

in usr/local/psa/admin/conf/templates/default/service/php_over_fastcgi.php

I have;
<IfModule fcgid.c>
instead fastcgi.c

As I read here, even if I see fastcgi enabled, this is not true and the server still use fcgid.

Can somebody help me edit this without generate downtime on the server (I have live websites on it).

Thanks in advance.

Best regards,
Laszlo
 
Let me clarify a little bit.
For each domain you can specify mode of PHP functioning - cgi, mod_php, mod_fcgid and fastcgi.
In two last cases the sections begin the same way <IfModule fcgid.c> but content is different.
For fastcgi mode the interpreter runs.
Mentioned file /usr/local/psa/admin/conf/templates/default/service/php_over_fastcgi.php is just template for generation of vhost's configs.
Learn more about Configuration Templates - http://download1.parallels.com/Ples...linux-advanced-administration-guide/68693.htm.
Right place is /var/www/vhosts/<hostname>/conf/last_<apache|httpd>.conf
 
Last edited by a moderator:
# rpm -qf /etc/httpd/modules/mod_fcgid.so
psa-mod_fcgid-2.3.6-12050315.i386
# rpm -q --info psa-mod_fcgid-2.3.6-12050315.i386 | grep Summary
Summary : Alternative FastCGI module for Apache2
===
mod_fcgid.so is the fastcgi module compiled for your system and packed into the psa-mod_fcgid package.
It's enabled by default and you don't need to compile and enable any another mod_fastcgi module! You already have it.
 
===
mod_fcgid.so is the fastcgi module compiled for your system and packed into the psa-mod_fcgid package.
It's enabled by default and you don't need to compile and enable any another mod_fastcgi module! You already have it.

And the reason APC uptime is always 0 if fastcgi module is working ?
 
I hope, it's plesk's way of implementing fastcgi, otherwise I wouldn't have a clue of what to change, to get APC working.

If you choose 'FastCGI-Application' within Plesk, it still uses
<IfModule fcgid.c>
[CONTENT]
</IfModule fcgid.c> , without changing the [CONTENT] that's as far as I understand it right now, what you have to change yourself, mentioned at post #2.
Nevertheless, I didn't get it working by now.... .
Tried everything I could think of, didn't work, that's why I've asked here: http://forum.parallels.com/showthread.php?t=262388
I hope someone can help us, I'd realy like to use APC... .
 
Ok. It's clear for me now that you meant not "How to enable FastCGI" but how to use "mod_fastcgi instead of mod_fcgid". I'll report this as a feature request.

BTW: didn't you try to modify custom apache template as Alexey.Plotnitsky recommend in the thread APC with FastCGI - uptime 0 ?
I added files:
# cat /usr/local/psa/admin/conf/templates/custom/service/mod_fastcgi.php
<IfModule mod_fastcgi.c>
<Files ~ (\.fcgi)>
SetHandler fastcgi-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
# cat /usr/local/psa/admin/conf/templates/custom/service/php_over_fastcgi.php
<IfModule mod_fastcgi.c>
<Files ~ (\.php)>
SetHandler fastcgi-script
Options +ExecCGI
allow from all
</Files>
</IfModule>

and applied instruction from FastCGI with a PHP APC Opcode Cache | Brandon's Blog with only one modification: replaced FastCgiWrapper in the mod_fastcgi.conf to:
FastCgiWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper
and all works fine as I see (except applying custom PHP settings per site).
 
I tried what Alexey.Plotnitsky said there, as I searched days for a solution, I even asked here and nobody knows: http://serverfault.com/questions/445884/apc-uptime-0-because-of-fast

I didn't tried the instructions from Brandon's blog. I will need to install a virtual machine with centos and a trial plesk and test, as the server in cause is operational and I can't stop or break the apache. I need it uptime so I can't play with it. I will try tonight if I am able.
 
solved....

Ok,
i guess i did it.... .
It seems to be working (APC does only work with fastcgi -> it's caching for about 30min 'till now)
Here's what I did
(gonna test it again tomorrow, on a fresh installation, to verify, this is working):
[I'm using apache2 and nginx as reverse proxy, 1 domain + subdomain, nothin special though]


I opend /etc/apache2/mods-enabled/fcgid.conf
changed everythin to:
<IfDefine FASTCGI>
LoadModule fastcgi_module modules/mod_fastcgi.so

FastCgiConfig -idle-timeout 20 -maxClassProcesses 1
/var/www/cgi-bin/cgi_wrapper/cgi_wrapper On

AddHandler php5-fcgi .php
Action php5-fcgi /cgi-bin/php-fastcgi


<Location "/cgi-bin/php-fastcgi">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
Options ExecCGI
SetHandler fastcgi-script
</Location>

</IfDefine>

Then I created (did i create it? :D not quite sure, as i said, gonna have a look at this tomorrow ):
/usr/local/psa/admin/conf/templates/custom/service/mod_fastcgi.php

<IfModule mod_fastcgi.c>
<Files ~ (\.php)>
SetHandler fastcgi-script
Options +ExecCGI
allow from all
</Files>
</IfModule>

after that, simply recreat all files required :
/usr/local/psa/admin/sbin/httpdmng --reconfigure-all

and restart apache:
/etc/init.d/apache2 restat
 
It doesn't... .
Don't know what i did yesterday, guess it was good luck or what so ever;
I'm restoring my backup from yesterday to see what's different.... .

If one of the Plesk-Team could help us again.... .

Altec
 
altec_lansing, try following config instead of yours:
# cat /etc/httpd/conf.d/mod_fastcgi.conf
LoadModule fastcgi_module modules/mod_fastcgi.so

<IfModule mod_fastcgi.c>
FastCgiConfig -idle-timeout 20 -maxClassProcesses 1
FastCgiWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper

AddHandler php5-fcgi .php
Action php5-fcgi /cgi-bin/php-fastcgi

<Location "/cgi-bin/php-fastcgi">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
Options ExecCGI
SetHandler fastcgi-script
</Location>
</IfModule>

# cat /usr/local/psa/admin/conf/templates/custom/service/mod_fastcgi.php
<IfModule mod_fastcgi.c>
<Files ~ (\.fcgi)>
SetHandler fastcgi-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
# cat /usr/local/psa/admin/conf/templates/custom/service/php_over_fastcgi.php
<IfModule mod_fastcgi.c>
<Files ~ (\.php)>
SetHandler fastcgi-script
Options +ExecCGI
allow from all
</Files>
</IfModule>

Then run:
/usr/local/psa/admin/sbin/httpdmng --reconfigure-all
 
Thanks for your reply.

/etc/httpd/conf.d/mod_fastcgi.conf
Doesn't exist, actually,
/etc/httpd/
doesnt't exist.

I used
/etc/apache2/mods-enabled/fastcgi.conf
instead.
If i apply your settings, my apache doesn't execute the php, but offers it as a download... .

If I change
#cat /usr/local/psa/admin/conf/templates/custom/service/php_over_fastcgi.php
<IfModule mod_fastcgi.c>
<Files ~ (\.php)>
SetHandler fastcgi-script
Options +ExecCGI
allow from all
</Files>
</IfModule>
to be like
# cat /usr/local/psa/admin/conf/templates/default/service/php_over_fastcgi.php
<IfModule mod_fcgid.c>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper <?php echo $VAR->server->webserver->apache->phpCgiBin ?> .php
Options +ExecCGI
allow from all
</Files>
</IfModule>

it doesn't work either (but no download is offered)
 
What is your OS? Debian/Ubuntu? "FCGIWrapper" is directive for mod_fcgid not for mod_fastcgi.
 
Strange on clean debian with Plesk 11.0.9 I installed:
# apt-get install libapache2-mod-fastcgi
modified fastcgi.conf:
# cat /etc/apache2/mods-available/fastcgi.conf
<IfModule mod_fastcgi.c>
FastCgiConfig -idle-timeout 20 -maxClassProcesses 1
FastCgiWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper
AddHandler fastcgi-script .fcgi
# FastCgiIpcDir /var/lib/apache2/fastcgi
</IfModule>
enabled the module and disabled fcgid in the apache configuration
add custom templates as I wrote above:
/usr/local/psa/admin/conf/templates/custom/service/php_over_fastcgi.php
/usr/local/psa/admin/conf/templates/custom/service/mod_fastcgi.php
and reconfigured all configs:
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

I didn't install APC this time but php over mod_fastcgi work fine:
[Wed Nov 28 20:53:00 2012] [notice] FastCGI: wrapper mechanism enabled (wrapper: /var/www/cgi-bin/cgi_wrapper/cgi_wrapper)
[Wed Nov 28 20:53:00 2012] [notice] FastCGI: process manager initialized (pid 2901)
[Wed Nov 28 20:53:07 2012] [warn] FastCGI: scheduled the start of the last (dynamic) server "/var/www/vhosts/a10-52-184-143.qa.plesk.ru/httpdocs/test/php/test.php" process: reached dynamicMaxClassProcs (1)
[Wed Nov 28 20:53:07 2012] [warn] FastCGI: (dynamic) server "/var/www/vhosts/a10-52-184-143.qa.plesk.ru/httpdocs/test/php/test.php" (uid 10000, gid 1005) started (pid 2911)
 
Ok, did it your way.... .
(I'm on Debain 6.06)
[Wed Nov 28 21:45:10 2012] [notice] FastCGI: wrapper mechanism enabled (wrapper: /var/www/cgi-bin/cgi_wrapper/cgi_wrapper)
[Wed Nov 28 21:45:10 2012] [notice] FastCGI: process manager initialized (pid 10625)
[Wed Nov 28 21:46:46 2012] [warn] FastCGI: scheduled the start of the last (dynamic) server "/var/www/vhosts/domain.tld/httpdocs/test.php" process: reached dynamicMaxClassProcs (1)
[Wed Nov 28 21:46:46 2012] [warn] FastCGI: (dynamic) server "/var/www/vhosts/domain.tld/httpdocs/test.php" (uid 10000, gid 1005) started (pid 10675)

APC is 'working'... .
Uptime is now at about 15min, but it's only caching: apc.php
:(

I don't get it.
I've got a backup from my server, 2 days ago, where APC works quite (..) well,
but I'd like to know why.
 
Last edited:
RuslanT I have tried your configuration in Centos 6 and I am getting:

[Sat Dec 08 17:44:21 2012] [alert] [client 173.245.53.217] (13)Permission denied: FastCGI: failed to connect to (dynamic) server "/var/www/vhosts/domain/httpdocs/index.php": something is seriously wrong, any chance the socket/named_pipe directory was removed?, see the FastCgiIpcDir directive
[Sat Dec 08 17:44:21 2012] [error] [client 173.245.53.217] FastCGI: incomplete headers (0 bytes) received from server "/var/www/vhosts/domain/httpdocs/index.php"


Any idea ?
 
Last edited:
Has this been resolved? I'm on CentOS 6 and Plesk 10.4.4, and am interested in enabling mod_fastcgi.so instead of mod_fcgid.so - in order to run PHP 5 via php-fpm. I am willing to give this a shot if someone can confirm that it works.
 
Has this been resolved? I'm on CentOS 6 and Plesk 10.4.4, and am interested in enabling mod_fastcgi.so instead of mod_fcgid.so - in order to run PHP 5 via php-fpm. I am willing to give this a shot if someone can confirm that it works.

Bad news for you: not yet...or maybe I should say just....not (as I can't see this working someday )
 
I know it is possible. i can easily get it working on a command-line-only CentOS system - the problem seems to be getting it working with Plesk.
 
RuslanT I have tried your configuration in Centos 6 and I am getting:

[Sat Dec 08 17:44:21 2012] [alert] [client 173.245.53.217] (13)Permission denied: FastCGI: failed to connect to (dynamic) server "/var/www/vhosts/domain/httpdocs/index.php": something is seriously wrong, any chance the socket/named_pipe directory was removed?, see the FastCgiIpcDir directive
[Sat Dec 08 17:44:21 2012] [error] [client 173.245.53.217] FastCGI: incomplete headers (0 bytes) received from server "/var/www/vhosts/domain/httpdocs/index.php"


Any idea ?

1. /var/www/vhosts/domain/httpdocs/index.php - domain is very strage looking domain name, how did you create it?
2. (13)Permission denied: - is there something in audit.log? Is selinux enforced?
 
Back
Top