• 14
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I am getting the following error when trying to start php-fpm56w in a Docker container running CentOS 6.6:

[root@1b9ec42c577b conf]# service php-fpm start
Starting php-fpm: [24-Jul-2015 19:37:53] NOTICE: PHP message: PHP Fatal error:  PHP Startup: apc_shm_create: shmget(0, 67108864, 914) failed: Invalid argument. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment. in Unknown on line 0
[24-Jul-2015 19:37:53] NOTICE: PHP message: PHP Fatal error:  PHP Startup: apc_shm_attach: shmat failed: in Unknown on line 0
/bin/bash: line 1:   724 Segmentation fault      /usr/sbin/php-fpm --daemonize
                                                           [FAILED]

I suspect that it is a shared memory issue. I have tried changing the shared memory size in /etc/php.d/opcache.ini

; The OPcache shared memory storage size.
opcache.memory_consumption=64

to 32 and 128 but it hasn't fixed the problem. I also upgraded the memory in the host VM, which is running CentOS 7, from 1 GB to 2 GB. Any ideas? Thanks!

      • 1
    • Unfortunately I've not actually done this before so I wasn't sure the protocol on "this might work" vs. "I know this will work."
      • 2
    • Using the --privileged flag when running the container (e.g. docker run -it --privileged --name -P b14 build8 bash) allows me to then change the kernel.shmmax setting inside the container like so: sysctl -w kernel.shmmax=268435456 (for 256 mb of shared memory) and then php-fpm starts up fine. Thanks @Mary!
      • 1
    • This is an OS setting you need to change at that level. The opcache.ini setting says what it will try to do, but not what it is allowed to do. It appears the Docker does not necessarily allow changing this to happen easily: groups.google.com/forum/#!topic/docker-dev/HTC_q92ILZs but to at least see if this is a source of trouble, try the command: sysctl -a | grep shm and check shmmax. You might also try setting memory_consumption to a smaller size (like 16 or 8) to also see if that helps.
    • @Mary - please don't answer in comments. This is a full-blown answer and deserves being treated as such.

As suggested by the thread @Mary linked to, using the --privileged flag when running the container (e.g. docker run -it --privileged --name -P b14 build8 bash) allows me to then change the kernel.shmmax setting inside the container like so: sysctl -w kernel.shmmax=268435456 (for 256 mb of shared memory) and then php-fpm starts up fine. Thanks @Mary!

Upon a container restart the shared memory size resets, so I have to again run the kernel.shmmax command.

  • 0
Reply Report

Trending Tags