Forum Moderators: phranque

Message Too Old, No Replies

Config help: PHP as FASTcgi on Windows2003 OS

Apache 2.2.4 - php 4.4.6

         

hydn79

2:20 am on May 7, 2007 (gmt 0)

10+ Year Member



Problem
---------------------------------------------------------------
I'm trying to switch from PHP installed as module (Apache) to PHPinstacll as FASTcgi - on Windows 2003 server. I've downloaded mod_fcgid-2.1-w32.zip from (apachelounge) and also just in case [fastcgi.com...] (mod_fastcgi-2.4.2-AP20.dll) but seems it's for Apache 2.0 and not 2.4. Let me know.

Question
---------------------------------------------------------------
What changes do I need to make to my Apache httpd.conf and Php.ini (cut and pasted below) in order to run PHP 4.4.6 as FASTCGI:

Php.ini
---------------------------------------------------------------
engine = On
expose_php = Off
short_open_tag = Off
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
serialize_precision = 100
allow_call_time_pass_reference = Off

safe_mode = Off
disable_functions = "system,exec,shell_exec,passthru,escapeshellcmd,popen,pcntl_exec"

max_execution_time = 60
max_input_time = 60
memory_limit = 512M

error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off

variables_order = "GPCS"
register_globals = Off
register_argc_argv = Off
define_syslog_variables = Off
post_max_size = 16M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off

open_basedir = "C:\apache\htdocs"
extension_dir = "C:\apache\php4\extensions"
default_mimetype = "text/html"
enable_dl = On
cgi.force_redirect = 1
cgi.rfc2616_headers = 0

file_uploads = On
upload_tmp_dir = "C:\windows\temp"
upload_max_filesize = 32M

allow_url_fopen = On
default_socket_timeout = 60

extension=php_curl.dll
extension=php_gd2.dll
extension=php_memcache.dll
extension=php_shmop.dll
;extension=php_sockets.dll
;extension=php_mbstring.dll
;extension=php_imap.dll

SMTP = 192.168.10.185
smtp_port = 25

mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

browscap = C:\apache\php4\extras\php_browscap.ini

session.save_handler = mm
session.save_path = "C:\apache\php4\sessions"
session.use_cookies = 1
session.name = PHPPINSTACK
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter =
session.cache_expire = 180
session.use_trans_sid = 0
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

zend_extension_manager.optimizer_ts="C:\zend\lib\Optimizer-3.2.6"
zend_extension_ts="C:\zend\lib\ZendExtensionManager.dll"

httpd.conf
-----------------------------------------------------------
ServerRoot "C:/Apache"
Listen 80
ServerName www.mysite.com:80
ServerAdmin myname@mysite.com
DocumentRoot "C:/Apache/htdocs"

NameVirtualHost *
<VirtualHost *>
ServerName www.mysite.com
DocumentRoot "C:/Apache/htdocs"
ServerAlias mysite.com
</VirtualHost>

<VirtualHost *>
ServerName forums.mysite.com
DocumentRoot "C:/Apache/htdocs/forums"
ServerAlias forums.mysite.com
</VirtualHost>

<VirtualHost *>
ServerName wap.mysite.com
DocumentRoot "C:/Apache/htdocs"
ServerAlias wap.mysite.com
</VirtualHost>

ThreadsPerChild 72
Timeout 5
KeepAlive On
MaxKeepAliveRequests 48
KeepAliveTimeout 5
MaxRequestsPerChild 0

LoadModule alias_module modules/mod_alias.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule dir_module modules/mod_dir.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule php4_module "C:/Apache/php4/php4apache2.dll"
PHPIniDir "C:/apache/php4"

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

ErrorLog "logs/error.log"
LogLevel warn
DefaultType text/plain
# MIMEMagicFile "conf/magic"

<Directory "C:/Apache/htdocs">
Options FollowSymLinks
Allow from all
Order allow,deny
AllowOverride none
</Directory>

<Directory "C:/Apache/htdocs/forums">
Options FollowSymLinks
Allow from all
Order allow,deny
AllowOverride none
RewriteEngine On
# RewriteBase /
# RewriteCond %{HTTP_HOST}!^www\.yourdomain\.com
# RewriteRule (.*) [yourdomain.com...] [L,R=301]
RewriteRule ^((urllist¦sitemap_).*\.(xml¦txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{QUERY_STRING}!vbseourl=
RewriteCond %{REQUEST_URI}!(admincp/¦modcp/¦chat¦cron)
RewriteRule ^(.*\.php)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME}!\.(jpg¦gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteCond %{REQUEST_FILENAME}!^(admincp¦modcp¦clientscript¦cpstyles¦images)/
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
</Directory>

<Directory "C:/Apache/cgi-bin">
Options FollowSymLinks
Allow from all
Order allow,deny
AllowOverride None
</Directory>

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

<IfModule alias_module>
Redirect permanent /images [images.mysite.com...]
Redirect permanent /images2 [images.mysite.com...]
ScriptAlias /cgi-bin/ "C:/Apache/cgi-bin/"
</IfModule>

<IfModule mime_module>
TypesConfig "conf/mime.types"
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
</IfModule>

Win32DisableAcceptEx
EnableMMAP On
EnableSendfile On
HostnameLookups Off
ServerSignature Off
ServerTokens Prod

Info:
Server 1 Web Server:
Windows 2003 Standard R2
2x dual core xeon 5140 2.33Ghz, 3GB RAM,
RAID 1 36GB OS & WebServer HDs
Apache 2.2.4
PHP 4.4.6 (Also tried 5.2.1)
Avg mem usgae: 400 - 500MB of 3GB
Avg CPU usage: 60% - 100%

Server 2 DB server:
Windows 2003 Standard R2
2x dual core xeon 5140 2.33Ghz, 3GB RAM,
36 GB Non RAID OS drive, D: = RAID 1 36GB SCSI HDs
Mysql 4.1.22
lighttpd 1.4.15
Avg mem usage: 0.9GB - 1.2GB of 3GB
Avg CPU usage: 5% - 15%

My Goal
---------------------------------------------------------------
To lower CPU usage on Web Server by tonight (for tomorrow's - Moday - traffic) since I've been reading around that Fastcgi performs noticeably better. PHP has been eating up CPU as traffic has increased a lot in last few months. Hardware has been upgraded and would like to compliment with FASTcgi.

Thanks for your help.