# apache2 & mod_fastcgi & php5 not working

## nemster

ok heres what i did:

i emerged mod_fastcgi, apache and php.

 *Quote:*   

> 
> 
> USE="-gtk -X -gnome -qt -kde mysql quotas syslog samba -unicode toolbar utf8 -motif -cups
> 
> cgi dba gd cli gd dba mysql php svg apache2 zlib session
> ...

 

 *Quote:*   

> 
> 
> PHP 5.0.5-pl5-gentoo (cgi-fcgi) (built: Mar 12 2006 22:38:11)
> 
> Server version: Apache/2.0.55
> ...

 

/etc/conf.d/apache2

```

APACHE2_OPTS="-D DEFAULT_VHOST -D FASTCGI -D PHP5"

```

/etc/apache2/modules.d/20_mod_fastcgi.conf:

```

<IfDefine FASTCGI>

        <IfModule !mod_fastcgi.c>

                LoadModule fastcgi_module     modules/mod_fastcgi.so

        </IfModule>

        <IfModule mod_fastcgi.c>

                AddHandler fastcgi-script .fcg

FastCgiWrapper /usr/sbin/suexec2

FastCgiServer /var/www/php-fcgi-scripts/igor/php-fcgi-starter -user igor -group users

AddHandler php-fastcgi .php

<Location /cgi-bin/php-fcgi-starter>

        SetHandler fastcgi-script

        Options +ExecCGI

</Location>

Action php-fastcgi /cgi-bin/php-fcgi-starter

AddType application/x-httpd-php .php

        </IfModule>

</IfDefine>

```

cat /var/www/php-fcgi-scripts/igor/php-fcgi-starter

```
#!/bin/sh

PHPRC="/var/www/php-fcgi-scripts/igor"

export PHPRC

PHP_FCGI_CHILDREN=4

export PHP_FCGI_CHILDREN

exec /usr/bin/php-cg

```

cat vhosts.d/00_default_vhost.conf

 *Quote:*   

> 
> 
> <VirtualHost igor.domain.com>
> 
>     ServerAdmin webmaster@domain.com
> ...

 

cat error_log:

 *Quote:*   

> 
> 
> [Mon Mar 13 00:22:33 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)
> 
> [Mon Mar 13 00:22:33 2006] [error] FastCGI: access for server (uid -1, gid -1) failed: read not allowed
> ...

 

whats wrong?

i could not find any usable guide to mod_fastcgi on gentoo... i tried to follow this one: http://www.debianhowto.de/de:howtos:sarge:apache2_php-fcgi

any help is appreciated

thanks

----------

## SoTired

What exactly isn't working?

The error_log errors look like they may be permission problems are /var/run/fastcgi and /var/run/fastcgi/dynamic chown'ed and chmod'ed correctly (probably apache:apache and 700)?

Also, (I think) it looks like you're trying to get PHP5 via fastcgi, if that's so then you don't need -D PHP5 in /etc/conf.d/apache2 and can compile php with -apache and -apache2, as those're for mod_php.

Aside from that, it looks like your DocumentRoot is set incorrectly in /etc/apache2/httpd.conf, or perhaps the request is being handled by a different virtual host -- doesn't look like it's getting to the igor one, at least.

And I assume there is an i at the end of the last line in your php-fcgi-starter script?

----------

## nemster

```

[Mon Mar 20 20:23:23 2006] [error] FastCGI: access for server (uid -1, gid -1) failed: read not allowed

[Mon Mar 20 20:23:23 2006] [error] FastCGI: can't create dynamic directory "/var/run/fastcgi/dynamic": access for server (uid -1, gid -1) failed: write not allowed

```

this somehow irritates me. 

what does uid -1 mean?

otherwise it works now, was probably really a vhost issue

----------

