Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#325 closed defect (invalid)

Windows / mod_fastcgi / Xcache

Reported by: starams5 Owned by: moo
Priority: major Milestone: black hole
Component: cacher Version: 3.0.3
Keywords: Memory Cc:
Application: PHP Version: PHP Version 5.4.16
Other Exts: SAPI: FastCGI
Probability: Always Blocked By:

Description (last modified by moo)

Hi Moo,

I need your help once again. I noticed apache was starting to crash on a regular basis. I had to implement new features (which should have been done sooner) to correct the problem.

As I'm sure you alraedy know, apache has memory issues running on windows, memory leaks, etc; I was able to correct the issue by setting the ThreadStackSize? to 8388608 and using the MaxRequestsPerChild? directive.

Most importantly, I enabled mod_fastcgi-2.4.6-AP22.dll. mod_fastcgi is working as it should be, and the server is now stable. However, I check the 3.0.3 Cacher and found the following:

Slots: 128.00 K 	
Size: 60.00 M 	
Available: 58.89 M


Windows Server 2008 R2
Duel Quad Core Xeons
16Gb Memory

Apache 2.2.21
MySQL 5.5.16
PHP Version 5.4.16

Xcache Settings:

;; this is an example, it won't work unless properly configured into php.ini
;; non-Windows example:
;;extension =
;; Windows example:
extension = php_xcache.dll

xcache.admin.enable_auth = Off
xcache.admin.user = "xxxxx"
; set xcache.admin.pass = md5($your_password)
; login use $your_password
xcache.admin.pass = "xxxxxx"

; ini only settings, all the values here is default unless explained

; select low level shm implemenation
xcache.shm_scheme =        "mmap"
; to disable: xcache.size=0
; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
xcache.size  =               60M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count =                 16
; just a hash hints, you can always store count(items) > slots
xcache.slots =                8K
; ttl of the cache item, 0=forever
xcache.ttl   =                 0
; interval of gc scanning expired items, 0=no scan, other values is in seconds
xcache.gc_interval =           0

; same as aboves but for variable cache
xcache.var_size  =            4M
xcache.var_count =             16
xcache.var_slots =            8K
; default value for $ttl parameter of xcache_*() functions
xcache.var_ttl   =             0
; hard limit ttl that cannot be exceed by xcache_*() functions. 0=unlimited
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300

; mode:0, const string specified by xcache.var_namespace
; mode:1, $_SERVER[xcache.var_namespace]
; mode:2, uid or gid (specified by xcache.var_namespace)
xcache.var_namespace_mode =    0
xcache.var_namespace =        ""

; N/A for /dev/zero
xcache.readonly_protection = Off
; for *nix, xcache.mmap_path is a file path, not directory. (auto create/overwrite)
; Use something like "/tmp/xcache" instead of "/dev/*" if you want to turn on ReadonlyProtection
; different process group of php won't share the same /tmp/xcache
; for win32, xcache.mmap_path=anonymous map name, not file path
xcache.mmap_path =    "/dev/zero"

; Useful when XCache crash. leave it blank(disabled) or "/tmp/phpcore/" (writable by php)
xcache.coredump_directory =   ""
; Windows only. leave it as 0 (default) until you're told by XCache dev
xcache.coredump_type =         0

; disable cache after crash
xcache.disable_on_crash =    Off

; enable experimental documented features for each release if available
xcache.experimental =        Off

; per request settings. can ini_set, .htaccess etc
xcache.cacher =               On
xcache.stat   =               On
xcache.optimizer =           Off

; enabling this feature will impact performance
; enabled only if xcache.coverager == On && xcache.coveragedump_directory == "non-empty-value"

; per request settings. can ini_set, .htaccess etc
; enable coverage data collecting and xcache_coverager_start/stop/get/clean() functions
xcache.coverager =           Off
xcache.coverager_autostart =  On

; set in php ini file only
; make sure it's readable (open_basedir is checked) by coverage viewer script
xcache.coveragedump_directory = ""

mod_fastcgi settings:

# Load mod_fcgid
LoadModule fastcgi_module modules/mod_fastcgi.dll

<IfModule fcgid_module>
AddHandler fcgid-script .fcgi .php

# Where to look for the php.ini file?
FcgidInitialEnv PHPRC        "c:/xampp/php"

# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
# to prevent php-cgi process from exiting before all requests completed
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS      1000

# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess       1000

# Number of seconds of idle time before a php-cgi process is terminated
FcgidIOTimeout             120
FcgidIdleTimeout                120
FcgidOutputBufferSize 128
FcgidIOTimeout 40
ProcessLifeTime 240
FcgidMaxProcesses             50

#Path to php-cgi
FcgidWrapper "c:/xampp/php/php-cgi.exe" .php
FcgidInitialEnv PATH "c:/xampp/php;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
FcgidInitialEnv SystemRoot "C:\\Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
FcgidInitialEnv windir "C:\\WINDOWS"

# Max request length
#FcgidMaxRequestLen 5242880
FcgidMaxRequestLen 1048576000

Also tried changing the paths to, same results:

#Path to php-cgi
FcgidWrapper "c:/xampp/php/php-cgi.exe" .php
FcgidInitialEnv PATH "c:/xampp/php;c:\windows\system32;c:\windows;c:\windows\system32\wbem;"
FcgidInitialEnv SystemRoot "c:\windows"
FcgidInitialEnv SystemDrive "c:"
FcgidInitialEnv TEMP "c:\windows\temp"
FcgidInitialEnv TMP "c:\windows\temp"
FcgidInitialEnv windir "c:\windows"

I did find this under 3.0.3 - Diagnosis:

SAPI Compatibility 	Error 	CGI is not supported 	Use FastCGI or FPM instead

The Xcache usage seems to be extremely low since enabling mod_fastcgi. Is this normal ? If not, please advise. Thank you.

Change History (3)

comment:1 Changed 6 years ago by starams5

Update: I switched to memcache and it's working well with fastcgi. I'll use it (memcache ) as an alternative until I hear from you. Thanks.

comment:2 Changed 6 years ago by moo

  • Description modified (diff)
  • Resolution set to invalid
  • Status changed from new to closed

I'm not windows/apache expert. I never used them for production

Please ask question in xcache @ google groups. Although the problem raised when you use XCache, it's not a XCache problem. Your target is: find a way to run php in FastCGI mode under windows, I'm not even sure if a solution to this is already there

memcache is for caching data, which is good at what it is for. but won't cache opcode of *.php

comment:3 Changed 6 years ago by moo

  • Milestone changed from undecided to black hole
Note: See TracTickets for help on using tickets.