eAccelerator with IIS running PHP with CGI

December 18, 2007 - 20:57
eAccelerator with IIS running PHP with CGI
Posts: 406
Joined: 2006-01-02

Posted for Phil (please, no support issues on the "download eAccelerator" page, post support issue here in the forums):
-------------------------------------
Hi Dear Chris,

I'm testing eAccelerator 0.9.5.2 on my local machine (Windows 2000 Professional + IIS 5) in order to use it into my server (Windows 2000 Server) then.

In IIS (Home directory, Application Mappings tab) I have .php -> c:\php\php-cgi.exe

I copied eaccelerator0952_5.2.5.dll into c:\php\ext directory and I renamed it to eaccelerator.dll.

Then I modified/added the following to c:\php\php.ini:
cgi.force_redirect = 0
fastcgi.impersonate = 1
extension_dir = "c:\php\ext"

extension="eaccelerator.dll"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="c:\php\eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys = "shm"
eaccelerator.sessions = "shm"
eaccelerator.content = "shm"
eaccelerator.allowed_admin_path = "c:\Inetpub\wwwroot\control.php"

extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll

* Running a test.php file containing I read:

PHP Version 5.2.5
System Windows NT VM2000 5.0 build 2195
Build Date Nov 8 2007 23:18:08
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"
Server API CGI/FastCGI
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\WINNT
Loaded Configuration File C:\PHP\php.ini
(...)
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
(...)
eAccelerator
eAccelerator support enabled
Version 0.9.5.2
Caching Enabled true
Optimizer Enabled true
Memory Size 67,108,824 Bytes
Memory Available 67,104,208 Bytes
Memory Allocated 4,616 Bytes
Cached Scripts 1
Removed Scripts 0
Cached Keys 0

Directive Local Value Master Value
eaccelerator.allowed_admin_path c:\Inetpub\wwwroot\control.php c:\Inetpub\wwwroot\control.php
eaccelerator.cache_dir c:\php\eaccelerator c:\php\eaccelerator
eaccelerator.check_mtime 1 1
eaccelerator.compress 1 1
eaccelerator.compress_level 9 9
eaccelerator.content shm shm
eaccelerator.debug 1 1
eaccelerator.enable 1 1
eaccelerator.filter no value no value
eaccelerator.keys shm shm
eaccelerator.log_file no value no value
eaccelerator.name_space no value no value
eaccelerator.optimizer 1 1
eaccelerator.sessions shm shm
eaccelerator.shm_max 0 0
eaccelerator.shm_only 0 0
eaccelerator.shm_prune_period 0 0
eaccelerator.shm_size 64 64
eaccelerator.shm_ttl 0 0
(...)

* The first time I launch the php -v from the command prompt, I read the following:

C:\Documents and Settings\Administrator>php -v
PHP 5.2.5 (cli) (built: Nov 8 2007 23:18:51)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccele
rator
Error in my_thread_global_end(): 1 threads didn't exit

* If I open the control.php file from the web browser I get the following:
eAccelerator 0.9.5.2 control panelInformation
Caching enabled yes
Optimizer enabled yes
Memory usage 0.09% (0.06MB/ 64.00MB)
Free memory 63.94MB
Cached scripts 1
(...)
Cached scripts
Filename MTime Size Reloads Hits
C:\Inetpub\wwwroot\control.php 2007-12-15 10:05 52.90 KB 1 (1) 1
(...)

If I try to open other PHP file the "Cached scripts" section always shows the "C:\Inetpub\wwwroot\control.php" only. So, other PHP script seem not correctly cached ("Cached scripts" always shows "1").

How could I solve this strange issue?
Many thanks in advance and... merry Christmas!



December 18, 2007 - 21:02
Posts: 406
Joined: 2006-01-02
To benefit from using eAccelerator you need to run PHP with phpXisapi.dll. If you run php with php-cgi.exe, each time you request a php page the full "PHP env." is loaded and unloaded at the end of serving each single php page. So no benefit in using eAccelerator.

You can also run php in a hybrid configuration using a semi-persistent "php env." for php-cgi.exe with techniques like: Setting up PHP as Fast CGI (FCGI) under Apache.