RE: PHP5 + fastcgi + apache2.2 ... how to for FreeBSD?

2009-10-20 Thread Johan Hendriks

Install from ports lang/php5

do NOT build the apache module (checkbox number 3)
│[ ] APACHE Build Apache module

Then install from ports www/mod_fcgid


Create a file in /usr/local/etc/apache22/Includes   (if you have apache22) else 
use the dir from your apache version.

Name it something like fcgi.conf

Put the following in there.

LoadModule fcgid_module libexec/apache22/mod_fcgid.so

IfModule mod_fcgid.c
AddHandler  fcgid-script .fcgi
Action  application/x-httpd-php /cgi-bin/php5.fcgi
AddHandler  application/x-httpd-php .php
/IfModule

DirectoryIndex index.html index.php


Now create a file in /usr/local/www/apache22/cgi-bin
Call this one php5.fcgi
make it executable: chmod ug+x /usr/local/www/apache22/cgi-bin/php5.fcgi
give it the right user and group: chmod www:www 
/usr/local/www/apache22/cgi-bin/php5.fcgi

In this file put the following
#!/bin/sh
PHPRC=/usr/local/etc
export PHPRC
#PHP_FCGI_CHILDREN=4
#export PHP_FCGI_CHILDREN
#PHP_FCGI_MAX_REQUESTS=5000
#export PHP_FCGI_MAX_REQUESTS
exec /usr/local/bin/php-cgi

I comment some things out, try for yourself if these works.
This should be it in great line.

Succes.
regards,
Johan Hendriks







-Oorspronkelijk bericht-
Van: owner-freebsd-questi...@freebsd.org 
[mailto:owner-freebsd-questi...@freebsd.org] Namens Marc G. Fournier
Verzonden: dinsdag 20 oktober 2009 0:22
Aan: freebsd-questions@freebsd.org
Onderwerp: PHP5 + fastcgi + apache2.2 ... how to for FreeBSD?


Is there one somewhere?  I'm finding *alot* of Debian ones dealing with 
their whole apget stuff, but would like to find something that speaks 
normally :)

Thx ...


Marc G. FournierHub.Org Hosting Solutions S.A.
scra...@hub.org http://www.hub.org

Yahoo:yscrappySkype: hub.orgICQ:7615664MSN:scra...@hub.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.422 / Virus Database: 270.14.20/2444 - Release Date: 10/18/09 
09:04:00

No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.5.422 / Virus Database: 270.14.20/2444 - Release Date: 10/18/09 
09:04:00
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: PHP5 + fastcgi + apache2.2 ... how to for FreeBSD?

2009-10-20 Thread Michael Powell
Marc G. Fournier wrote:

 
 Is there one somewhere?  I'm finding *alot* of Debian ones dealing with
 their whole apget stuff, but would like to find something that speaks
 normally :)
 
[snip]

Install your choice of flavor of Apache. Me, I'm using the event-mpm for 
testing to verify the way to use non-thread safe PHP with a threaded server 
is FastCGI.


Install lang/php5 with various CLI options, as opposed to and instead of 
mod_php. This is set of options I used:

# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for php5-5.2.11
_OPTIONS_READ=php5-5.2.11
WITH_CLI=true
WITH_CGI=true
WITHOUT_APACHE=true
WITHOUT_DEBUG=true
WITH_SUHOSIN=true
WITH_MULTIBYTE=true
WITHOUT_IPV6=true
WITHOUT_MAILHEAD=true
WITH_REDIRECT=true
WITH_DISCARD=true
WITH_FASTCGI=true
WITH_PATHINFO=true

Do not try and use MAILHEAD and SUHOSIN together; that combination is 
broken. Install the /lang/php5-extensions you require. Currently there seems 
to be a problem with extension=sqlite.so, and since I don't use/need it's 
commented out of my extensions.ini.


Install www/mod_fcgid from ports. In httpd.conf use:

LoadModule fcgid_module libexec/apache22/mod_fcgid.so

instead of the usual:

LoadModule php5_modulelibexec/apache22/libphp5.so


Also, further down in httpd.conf:

[...]
# This should be changed to whatever you set DocumentRoot to.
#
Directory /usr/local/www/apache22/data

[...]

/Directory

# added to enable mod_fcgid

IfModule mod_fcgid.c
  AddHandler fcgid-script .fcgi .php
  SocketPath /var/run/fcgidsock/
  IPCConnectTimeout 10
  IPCCommTimeout 20
  OutputBufferSize 0
/IfModule


#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
IfModule dir_module
DirectoryIndex index.html index.php
/IfModule
[...]


If all went well you should be able to restart Apache and be in business. A 
phpinfo(); should execute and provide details. Any problems the quickest way 
to check PHP is to just execute php -v at a shell prompt. If it doesn't 
segfault it will print out a short descriptive output text.

I believe this is better than the usual script based approach you will 
locate on the web. It starts/spawns PHP as a long running process when 
Apache starts instead of starting a new CGI each time PHP script is 
executed. 

The mod_fcgid is configurable:

http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

I believe this project was fairly recently folded into the Apache.org 
umbrella, but when I began it was separate and standalone. The docs on the 
Apache site look like they are for the upcoming 2.3 update to 2.2, and there 
may be discrepancies present. I had originally used the docs from the old 
site and I don't know if they are even still available.

-Mike


P.S. - Also, if you need to use Alias they will look like this:

Alias   /xcache-admin   /usr/local/share/examples/xcache/admin/
Directory /usr/local/share/examples/xcache/admin/
#SetHandler None
FCGIWrapper /usr/local/bin/php-cgi .php
Options ExecCGI
Order allow,deny
Allow from 192.168.10.2
Deny from none
/Directory




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


PHP5 + fastcgi + apache2.2 ... how to for FreeBSD?

2009-10-19 Thread Marc G. Fournier


Is there one somewhere?  I'm finding *alot* of Debian ones dealing with 
their whole apget stuff, but would like to find something that speaks 
normally :)


Thx ...


Marc G. FournierHub.Org Hosting Solutions S.A.
scra...@hub.org http://www.hub.org

Yahoo:yscrappySkype: hub.orgICQ:7615664MSN:scra...@hub.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org