# Problem with eaccelerator



## caban (Jul 21, 2010)

Hello I have a such problem.


```
rechnername# uname -a
FreeBSD rechnername.domain.tld 8.0-RELEASE FreeBSD 8.0-RELEASE #3: Wed Jul  7 23:33:29 NOVST 2010     
[email]root@rechnername.domain.tld[/email]:/usr/src/sys/amd64/compile/NEW_KERNEL  amd64

rechnername# grep eac /usr/local/etc/php.ini
zend_extension="/usr/local/lib/php/20090626-debug/eaccelerator.so"
eaccelerator.enable="1"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max = "0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

rechnername# cat /usr/ports/www/eaccelerator/Makefile
# New ports collection makefile for:    eaccelerator
# Date created:                 Sat Mar 1 13:55:55 CET 2003
# Whom:                         Alex Dupre <sysadmin@alexdupre.com>
#
# $FreeBSD: ports/www/eaccelerator/Makefile,v 1.41 2010/06/01 08:37:37 ale Exp $
#

PORTNAME=       eaccelerator
PORTVERSION=    0.9.6.1
CATEGORIES=     www
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}/eAccelerator%20${PORTVERSION}/ \
                http://bart.eaccelerator.net/source/${PORTVERSION}/

MAINTAINER=     [email]ale@FreeBSD.org[/email]
COMMENT=        A free open-source PHP accelerator & optimizer

USE_PHP=        yes
USE_PHPIZE=     yes
USE_PHP_BUILD=  yes
IGNORE_WITH_PHP=4

CONFIGURE_ARGS= --enable-eaccelerator=shared \
--with-eaccelerator-shared-memory --with-eaccelerator-userid=80 \
--with-eaccelerator-sessions --with-eaccelerator-content-caching \
 --without-eaccelerator-encoder   --without-eaccelerator-loader

USE_BZIP2=      yes
SUB_FILES=      pkg-message
PKGMESSAGE=     ${WRKDIR}/pkg-message

PORTDOCS=       *

.include <bsd.port.pre.mk>

do-install:
        @${MKDIR} ${PREFIX}/lib/php/${PHP_EXT_DIR}
        ${INSTALL_DATA} ${WRKSRC}/modules/${PORTNAME}.so \
               ${PREFIX}/lib/php/${PHP_EXT_DIR}

post-install:
.if !defined(NOPORTDOCS)
        @${MKDIR} ${DOCSDIR}
        ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
.endif
        @${MKDIR} ${EXAMPLESDIR}
        ${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.ini ${EXAMPLESDIR}
        ${INSTALL_DATA} ${WRKSRC}/control.php ${EXAMPLESDIR}
        ${INSTALL_DATA} ${WRKSRC}/dasm.php ${EXAMPLESDIR}
        @${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>

rechnername# /usr/local/etc/rc.d/php-fpm start
Starting php_fpm.
eAccelerator: shmmax should be at least 2MBPHP Warning:  [eAccelerator] Can not create shared memory area in Unknown on line 0
Unknown(0) : Warning - [eAccelerator] Can not create shared memory area
PHP Fatal error:  Unable to start eAccelerator module in Unknown on line 0
Unknown(0) : Fatal error - Unable to start eAccelerator module
/usr/local/etc/rc.d/php-fpm: WARNING: failed to start php_fpm
```

I used patch from this, but it did not help.


----------



## SirDice (Jul 21, 2010)

You need to increase shmmax which is a sysctl(8).


```
dice@williscorto:~>sysctl -a | grep shmmax
kern.ipc.shmmax: 33554432
```


----------



## caban (Jul 21, 2010)

Another problem
I can't change this value.


----------



## DutchDaemon (Jul 21, 2010)

Show the output, it should be possible.


```
# sysctl kern.ipc.shmmax                                                                                                               
kern.ipc.shmmax: 33554432
# sysctl kern.ipc.shmmax=33554430                                                                                                          
kern.ipc.shmmax: 33554432 -> 33554430
# sysctl kern.ipc.shmmax=33554432                                                                                                          
kern.ipc.shmmax: 33554430 -> 33554432
```


----------



## caban (Jul 21, 2010)

sorry, I do wrong thing's


----------



## DutchDaemon (Jul 22, 2010)

Is this solved?


----------



## batence (Nov 15, 2013)

```
nt001# uname -a
NetBSD nt001 6.1_STABLE NetBSD 6.1_STABLE (Core-$Revision: 1.1066.2.7 $) #0: Fri Nov 15 15:42:35 EET 2013  root@nt001:/usr/obj/sys/arch/i386/compile/nt001 i386

nt001# sysctl kern.ipc.shmmax
kern.ipc.shmmax = 125710336
nt001# sysctl kern.ipc.shmmax=33554430
sysctl: Must specify -w to set variables
nt001# sysctl -w kern.ipc.shmmax=33554430
kern.ipc.shmmax: 125710336 -> 33554430
nt001# sysctl -w kern.ipc.shmmax=33554432
kern.ipc.shmmax: 33554432 -> 33554432
nt001# apachectl restart
httpd not running, trying to start
nt001# apachectl restart
httpd not running, trying to start
nt001# nano /var/log/httpd/error_log
```


```
[Fri Nov 15 20:15:09 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
eAccelerator: shmmax should be at least 2MBPHP Warning:  [eAccelerator] Can not create shared memory area in Unknown on line 0
PHP Fatal error:  Unable to start eAccelerator module in Unknown on line 0
```

How to define "shmmax should be at least 2MBPHP" mean, specially "MBPHP"?


```
nt001# php -v
PHP 5.3.27 (cli) (built: Nov 15 2013 12:33:53)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
```

RE: SOLUTION
After some research, I found the solution:



> Freebsd has an issue with eAccelerator right now where when you try to start it it gives you an error "eAccelerator: shmmax should be at least 2MBPHP Warning"
> 
> To fix this we're going to remove eAccelerator then reinstall it:
> 
> ...



Source: http://techtouch.ca/blog/2012/03/27/eaccelerator-freebsd-error-shmmax/


----------



## ondra_knezour (Nov 15, 2013)

Try to set it in your php.ini file, see https://github.com/eaccelerator/eaccelerator/wiki/Settings

Cryptic 2MBPHP mean 2 megabytes, new line missing, PHP Warning


----------

