Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been Googling and researching the topic for quite a while but found only one thorough guide... That don't work.

I want to run PHP through mod_fcgid on Apache2 - CentOS 5.3.

With my current configuration I get 500 Internal Server Error on .php-files. Could you please help me figure out why? :)

httpd.conf:

<Directory "/var/www/html/">
    Options Indexes ExecCGI
    AllowOverride None
    Allow from all

    AddHandler fcgid-script .php
    FCGIWrapper /var/www/cgi-bin/php5/php-fcgi-starter .php
</Directory>

/var/www/cgi-bin/php5/php-fcgi-starter:

#!/bin/sh
PHPRC=/etc/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=8
exec /usr/bin/php-cgi

php-cgi -v:

PHP 5.2.6 (cgi-fcgi) (built: May  2 2008 16:01:17)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with the ionCube PHP Loader v3.1.29, Copyright (c) 2002-2007, by ionCube Ltd.

SeLinux is turned of.

EDIT: Logs...

[Mon Nov 02 05:17:49 2009] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Mon Nov 02 05:17:53 2009] [error] Not even headers for me :(
[Mon Nov 02 05:17:54 2009] [notice] mod_fcgid: call /var/www/html/phpinfo.php with wrapper /var/www/cgi-bin/php5/php-fcgi-starter
[Mon Nov 02 05:17:54 2009] [notice] mod_fcgid: server /var/www/html/phpinfo.php(13917) started
[Mon Nov 02 05:17:57 2009] [notice] mod_fcgid: process /var/www/html/phpinfo.php(13917) exit(communication error), terminated by calling exit(), return code: 120

SuExec_log:

[2009-11-02 04:55:27]: uid: (10001/www) gid: (2524/2524) cmd: php5
[2009-11-02 04:55:27]: target uid/gid (10001/2524 or 2523) mismatch with directory (10001/2523) or program (0/0)
[2009-11-02 04:57:19]: uid: (10001/www) gid: (2524/2524) cmd: php-fcgi-starter
[2009-11-02 04:57:19]: target uid/gid (10001/2524 or 2523) mismatch with directory (0/0) or program (0/0)

Thank you :)

share|improve this question
    
Show us yer logs, luv! –  womble Nov 2 '09 at 13:56
    
Sorry, now you have them. –  Christoffer Nov 2 '09 at 14:18
    
Are you using SuExec by chance? Take a look at your suexec.log, if it contains an error message for your script. –  joschi Nov 2 '09 at 15:22
    
It seems I do use SuExec... Added the log... –  Christoffer Nov 2 '09 at 15:27
add comment

1 Answer

up vote 2 down vote accepted

SUExec is requiring that the directory (/var/www/html/) and the binary (/var/www/cgi-bin/php5/php-fcgi-starter) be owned by the same user/group. Looks like 10001/2523 owns the dir, and root owns php-fcgi-starter. Fix that, or turn off SUExec.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.