Cache not being read properly?

August 15, 2006 - 10:35
Cache not being read properly?
Posts: 16
Joined: 2006-08-15

Ok, I must have some basic config problem here. I just switched to eAccelerator after tearing my hair out with Alternative PHP Cache only to run into the same exact problem.

Get everything up and running. I can run the admin eaccelerator.php, but nothing is ever actually saved and thus nothing is ever actually retrieved from cache.

I see files in the directory I specified for eaccelerator.cache_dir, but that's as far as things get. When I run the admin script the only thing I see in the cache is the admin script itself, and the Hits never display anything other than 1, no matter how many times I reload.

[correction: Now the Hits only display 0, I'm not sure why the one time they showed as 1]

Any suggestions what so ever are greatly appreciated.

Josh



August 15, 2006 - 22:01
Posts: 411
Joined: 2006-01-02

Hi Josh,

Maybe I will have to post this as some type of "sticky":

Please provide all possible details about your specific configuration and the versions of software you are running.

Thanks,
C



August 16, 2006 - 07:11
Posts: 16
Joined: 2006-08-15

Sorry about that, we're running (or attempting to get up and running) PHP 4.4.3 with eAccelerator 0.9.4. The OS is Win2k3. We also have CURL, MCrypt, and GD2 loaded. Is there anything else that's generally helpful to know about the configuration?

I've run MMCache for years without a hickup and on the same box at that. I really don't understand what I could be doing wrong.

Josh



August 16, 2006 - 09:06
Posts: 411
Joined: 2006-01-02

Or you running IIS or Apache ? and what versions ?
You have PHP running 100% fine before trying to use EA ?



August 16, 2006 - 09:35
Posts: 16
Joined: 2006-08-15

We're running IIS 6 and yes, other than EA everything works fine.



August 16, 2006 - 09:50
Posts: 411
Joined: 2006-01-02

Make sure you are not loading more the one accelerator (check your php.ini).
What do your ea configuration directives look like in your php.ini ?



August 16, 2006 - 17:50
Posts: 16
Joined: 2006-08-15

I can't find any duplicate extension entries for eAccelerator.

I copied the eAccelerator.ini into php.ini, removing the extension section (it's refered to in the general extension section) and changed the entries for the log file and the cache directory. I also set the user name and password though strangely enough that doesn't work either, but I'll ask about that later. I also commented the Zend Optimizer section as instructed by the About this file section below.

[Edit: I have never seen anything appear in the log file. I just turned the debug flag on and I still don't have any log entries. I thought that might indicate something.]

Here is what I pasted:

[eaccelerator]

;;;;;;;;;;;;;;;;;;;
; About this file ;
;;;;;;;;;;;;;;;;;;;
;
; eAccelerator is compatible with Zend Optimizer's loader. Zend Optimizer
; must be installed after eAccelerator in php.ini. If you don't use scripts
; encoded with Zend Encoder then we do not recommend you install Zend Optimizer
; with eAccelerator.

; The amount of shared memory (in megabytes) that eAccelerator will use.
; "0" means OS default. Default value is "0".
eaccelerator.shm_size = "0"

; The directory that is used for disk cache. eAccelerator stores precompiled
; code, session data, content and user entries here. The same data can be
; stored in shared memory also (for more quick access). Default value is
; "/tmp/eaccelerator".
eaccelerator.cache_dir = "C:\temp\zz_eAccelerator"

; Enables or disables eAccelerator. Should be "1" for enabling or
; "0" for disabling. Default value is "1".
eaccelerator.enable = "1"

; Enables or disables internal peephole optimizer which may speed up code
; execution. Should be "1" for enabling or "0" for disabling.
; Default value is "1".
eaccelerator.optimizer = "1"

; Enables or disables debug logging. Setting this to 1 will print information
; to the log file about the cach hits of a file.
eaccelerator.debug = 0

; Set the log file for eaccelerator. When this option isn't set then the data
; will be logged to stderr
eaccelerator.log_file = "D:\LOGS\eaccelerator.log"

; A string that's prepended to all keys. This allows two applications that use the
; same key names to run on the same host by setting this in .htaccess or in the main
; configuration file for the whole webserver.
eaccelerator.name_space = ""

; Enables or disables PHP file modification checking. Should be "1"
; for enabling or "0" for disabling. You should set it to "1" if you want
; to recompile PHP files after modification. Default value is "1".
eaccelerator.check_mtime = "1"

; Determine which PHP files must be cached. You may specify the number of
; patterns (for example "*.php *.phtml") which specifies to cache or
; not to cache. If pattern starts with the character "!", it means to ignore
; files which are matched by the following pattern. Default value is "" that
; means - all PHP scripts will be cached.
eaccelerator.filter = ""

; Disables putting large values into shared memory by "eaccelerator_put()"
; function.
; It indicates the largest allowed size in bytes (10240, 10K, 1M). The "0"
; disables the limit. Default value is "0".
eaccelerator.shm_max = "0"

; When eAccelerator fails to get shared memory for new script it removes
; all scripts which were not accessed at last "shm_ttl" seconds from shared
; memory. Default value is "0" that means - don't remove any files from
; shared memory.
eaccelerator.shm_ttl = "0"

; When eAccelerator fails to get shared memory for new script it tryes to
; remove old script if the previous try was made more then "shm_prune_period"
; seconds ago. Default value is "0" that means - don't try to remove any
; files from shared memory.
eaccelerator.shm_prune_period = "0"

; Enables or disables caching of compiled scripts on disk. It has no effect
; on session data and content caching.
; Default value is "0" that means - use disk and shared memory for caching.
eaccelerator.shm_only = "0"

; Enables or disables cached content compression. Default value is "1" that
; means enable compression.
eaccelerator.compress = "1"

; Compression level used for content caching. Default value is "9" which i
; is the maximum compression level
eaccelerator.compress_level = "9"

; Determine where keys, session data and content will be cached. The possible
; values are:
; "shm_and_disk" - cache data in shared memory and on disk (default value)
; "shm" - cache data in shared memory or on disk if shared memory
; is full or data size greater then "eaccelerator.shm_max"
; "shm_only" - cache data in shared memory
; "disk_only" - cache data on disk
; "none" - don't cache data
eaccelerator.keys = "shm_and_disk"
eaccelerator.sessions = "shm_and_disk"
eaccelerator.content = "shm_and_disk"

; eAccelerator can be managed through web interface script eaccelerator.php. So
; you need to put this file on your web site. For security reasons it is
; recommended to restrict the usage of this script by your local IP.
;
; To create the eAccelerator password type
;
; php -q eaccelerator_password.php
; Changing password for eAccelerator Web Interface (eaccelerator.php)
;
; Enter admin name: admin
; New admin password: eaccelerator
; Retype new admin password: eaccelerator

eaccelerator.admin.name="ea"
eaccelerator.admin.password="ea"



August 17, 2006 - 11:22
Posts: 411
Joined: 2006-01-02

Try something like:
eaccelerator.shm_size = "32"

For the password (it think it needs to be md5 encoded) it will look more like:
eaccelerator.admin.password="$2$avd2.M04.$AHsPASSWORDdsesENCRYPTEDdcETRmK3"

See this article for details: http://www.sitebuddy.com/PHP/Accelerators/eAccelerator

Also I would try to limit potentiel issues (ie file permissions):
eaccelerator.shm_only="1"
eaccelerator.keys = "none"
eaccelerator.sessions = "none"
eaccelerator.content = "none"

Let us know how it goes.



August 18, 2006 - 14:05
Posts: 16
Joined: 2006-08-15

Ok, I'm going to have to apologize profusely for this one. I missed a very crucial sentence in the README file.

eAccelerator does not work in CGI mode but it does work in Fast-CGI mode with webservers like lighttpd.

With that said, how stable is the ISAPI? I've heard that it wasn't very stable, but I've also seen some comments to the contrary more recently.

Josh



August 19, 2006 - 09:57
Posts: 411
Joined: 2006-01-02

Been running PHP as an IIS_5 ISAPI extension, since many years, with no issue.
Most application today are developped to work with the PHP DLL.



August 19, 2006 - 19:59
Posts: 16
Joined: 2006-08-15

Glad to hear it. Are there any ISAPI specific programming practices or gotcha's versus CGI?