mod_fcgid with apache22-worker-mpm help

Had apache22 (prefork) and mod_php5 plus phpmyadmin worked perfectly fine with 9.1-RELEASE-p11, rock solid.

Now that I need py-django15 with mod_wsgi3 and Googled hours and read best to have threaded apache22 so went ahead to portmaster -e apache22 and portmaster apache22-worker-mpm. Before that, per suggestion in the forum, compiled devel/apr1 with thread enabled.

Alas, mod_php5 was not happy it isn't apache22 thread safe. Googled hours again and read about mod_fcgid, went ahead to install it. Followed http://www.cyberciti.biz/faq/freebsd-apache22-fastcgi-php-configuration/ and hours later...failed miserably to get it up and running with a simple php script let alone phpmyadmin.

Apache serves DocumentRoot ok (with an index.html) with the standard original directives, but as soon as I put the following:
Code:
<Directory "/usr/local/www/apache22/data">
    SetHandler fcgid-script
    FCGIWrapper /usr/local/bin/php-cgi .php
    Options ExecCGI
</Directory>

gives 403s 'Forbidden. You don't have permission to access / on this server.'.

As for phpmyadmin, it gives me 500 'Internal Server Error' with the standard original directives. If I set the directive to the following:
Code:
Alias /phpmyadmin "/usr/local/www/phpMyAdmin"

<Directory "/usr/local/www/phpMyAdmin">
    FCGIWrapper /usr/local/bin/php-cgi .php
    Options FollowSymLinks ExecCGI
    SetHandler fcgid-script
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

It gives me 403s 'Forbidden. You don't have permission to access / on this server.'.

I am sure either I missed some installation step or there's a configuration elsewhere I need to do, but I just couldn't figure it out.

Help is really appreciated to get this setup working. Any suggestion to run py-django15/ mod_wsgi1 with apache22 (prefork)/ mod_php5 I'll be grateful too.

Thanks
 
The 403 forbidden usually happens when you haven't defined DirectoryIndex properly. If it cannot find any of those files it will try to give you a filelist, which is disabled by default resulting in the 403 forbidden.
 
Thanks for your suggestion, SirDice. I double checked, info.php (which is in DocumentRoot) is in DirectoryIndex and has both read and execute permission for others.
 
Update:

I did the following:
Code:
php-cgi index.php

index.php is basically phpinfo(). Gave me html on screen, saved as .html file and opened on my browser and I can see PHP is working but not in Apache22.

Anyone? Help please, thanks.
 
To enable php you have to add next lines to httpd.conf file:
Code:
<IfModule mime_module>
...
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
 
Thank you vejnovic. I tried to add but apache22 still gave me 403 forbidden accessing /.

I'm suspecting file permission somewhere. Here's my httpd.conf:
Code:
ServerRoot "/usr/local"

Listen 80

LoadModule authn_file_module libexec/apache22/mod_authn_file.so
LoadModule authn_dbm_module libexec/apache22/mod_authn_dbm.so
LoadModule authn_anon_module libexec/apache22/mod_authn_anon.so
LoadModule authn_default_module libexec/apache22/mod_authn_default.so
LoadModule authn_alias_module libexec/apache22/mod_authn_alias.so
LoadModule authz_host_module libexec/apache22/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache22/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache22/mod_authz_user.so
LoadModule authz_dbm_module libexec/apache22/mod_authz_dbm.so
LoadModule authz_owner_module libexec/apache22/mod_authz_owner.so
LoadModule authz_default_module libexec/apache22/mod_authz_default.so
LoadModule auth_basic_module libexec/apache22/mod_auth_basic.so
LoadModule auth_digest_module libexec/apache22/mod_auth_digest.so
LoadModule file_cache_module libexec/apache22/mod_file_cache.so
LoadModule cache_module libexec/apache22/mod_cache.so
LoadModule disk_cache_module libexec/apache22/mod_disk_cache.so
LoadModule dumpio_module libexec/apache22/mod_dumpio.so
LoadModule reqtimeout_module libexec/apache22/mod_reqtimeout.so
LoadModule include_module libexec/apache22/mod_include.so
LoadModule filter_module libexec/apache22/mod_filter.so
LoadModule charset_lite_module libexec/apache22/mod_charset_lite.so
LoadModule deflate_module libexec/apache22/mod_deflate.so
LoadModule log_config_module libexec/apache22/mod_log_config.so
LoadModule logio_module libexec/apache22/mod_logio.so
LoadModule env_module libexec/apache22/mod_env.so
LoadModule mime_magic_module libexec/apache22/mod_mime_magic.so
LoadModule cern_meta_module libexec/apache22/mod_cern_meta.so
LoadModule expires_module libexec/apache22/mod_expires.so
LoadModule headers_module libexec/apache22/mod_headers.so
LoadModule usertrack_module libexec/apache22/mod_usertrack.so
LoadModule unique_id_module libexec/apache22/mod_unique_id.so
LoadModule setenvif_module libexec/apache22/mod_setenvif.so
LoadModule version_module libexec/apache22/mod_version.so
LoadModule ssl_module libexec/apache22/mod_ssl.so
LoadModule mime_module libexec/apache22/mod_mime.so
LoadModule dav_module libexec/apache22/mod_dav.so
LoadModule status_module libexec/apache22/mod_status.so
LoadModule autoindex_module libexec/apache22/mod_autoindex.so
LoadModule asis_module libexec/apache22/mod_asis.so
LoadModule info_module libexec/apache22/mod_info.so
#LoadModule cgi_module libexec/apache22/mod_cgi.so
LoadModule dav_fs_module libexec/apache22/mod_dav_fs.so
LoadModule vhost_alias_module libexec/apache22/mod_vhost_alias.so
LoadModule negotiation_module libexec/apache22/mod_negotiation.so
LoadModule dir_module libexec/apache22/mod_dir.so
LoadModule imagemap_module libexec/apache22/mod_imagemap.so
LoadModule actions_module libexec/apache22/mod_actions.so
LoadModule speling_module libexec/apache22/mod_speling.so
LoadModule userdir_module libexec/apache22/mod_userdir.so
LoadModule alias_module libexec/apache22/mod_alias.so
LoadModule rewrite_module libexec/apache22/mod_rewrite.so
#LoadModule php5_module        libexec/apache22/libphp5.so
LoadModule wsgi_module        libexec/apache22/mod_wsgi.so
#added by ijunus on 140416 at 15:05
LoadModule fcgid_module libexec/apache22/mod_fcgid.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
    User www
    Group www
</IfModule>
</IfModule>

<IfModule mod_fcgid.c>
    AddHandler fcgid-script .fcgi
    FCGIWrapper /usr/local/bin/php-cgi .php
</IfModule>

ServerAdmin you@example.com

ServerName 192.168.1.1:80

DocumentRoot "/usr/local/www/apache22/data"

<Directory />
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

<Directory "/usr/local/www/apache22/data">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all

    SetHandler fcgid-script
    FCGIWrapper /usr/local/bin/php-cgi .php
    Options ExecCGI
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

ErrorLog "/var/log/httpd-error.log"

LogLevel debug

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "/var/log/httpd-access.log" combined
</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/usr/local/www/apache22/cgi-bin/"
</IfModule>

<IfModule cgid_module>
    #Scriptsock /var/run/cgisock
</IfModule>

<Directory "/usr/local/www/apache22/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>
    TypesConfig etc/apache22/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
</IfModule>

Include etc/apache22/extra/httpd-languages.conf

<IfModule ssl_module>
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
</IfModule>

Include etc/apache22/Includes/*.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Alias /phpmyadmin "/usr/local/www/phpMyAdmin"

<Directory "/usr/local/www/phpMyAdmin">
   AllowOverride All
   Order allow,deny
   Allow from all
</Directory>

BTW, is there any other .conf that I need? Appreciate any comment from anyone.

I stumbled upon this article in Russian while Googling:
http://translate.google.com/transla...reebsd+mod_fcgid+phpmyadmin&biw=1152&bih=1079

Do I need to run virtual host for apache22 in worker mode? Thanks again for any help.
 
Back
Top