PHP na linha de comando exibe “Out of Memory”, nenhum nome de arquivo, número de linha ou valor de memória

8

Originalmente postei isso no link , mas foi aconselhado para postar aqui em vez disso.

Este não é o erro fatal normal quando você fica sem memória em um script, pois não fornece um nome de arquivo, um número de linha ou a quantidade de memória usada. Ele simplesmente diz "Sem memória" sempre que eu tento executar o php na linha de comando, quando você passa um script ou simplesmente executa o php sozinho. Mesmo tentando executar um script que não existe dá a mesma mensagem.

Em outras palavras, eu entendo isso:

dan@server [~]# php
Out of memory
dan@server [~]# php test.php
Out of memory
dan@server [~]# php doesntexist.php
Out of memory
dan@server [~]# php -v
Out of memory

No entanto, o PHP através do Apache funciona absolutamente bem. É apenas na CLI que recebo esse erro.

A máquina em questão está rodando o CentOS release 5.7 (Final) que é de 64 bits e o PHP 5.3.10. É um servidor dedicado.

Eu tentei executar ulimit -a como dan como sugerido e esta é a saída:

core file size          (blocks, -c) 200000
data seg size           (kbytes, -d) 200000
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 37888
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) 200000
open files                      (-n) 100
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 35
virtual memory          (kbytes, -v) 200000
file locks                      (-x) unlimited

free -m on root dá isto:

             total       used       free     shared    buffers     cached
Mem:          3824       3714        110          0        142       2632
-/+ buffers/cache:        939       2885
Swap:         3490          0       3490

E o uso de memória do topo:

Mem:   3916648k total,  3797056k used,   119592k free,   145820k buffers
Swap:  3574452k total,      168k used,  3574284k free,  2686844k cached

UPDATE: Reiniciou o servidor ontem e funcionou pelo resto da tarde. No entanto, hoje está fazendo a mesma coisa.

Executando "strace php test.php" (um arquivo que existe), bem, isso continua por um tempo, mas a última página em putty foi esta:

fstat(3, {st_mode=S_IFREG|0644, st_size=100030, ...}) = 0
mmap(NULL, 100030, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2ad3ce0af000
close(3)                                = 0
open("/lib64/libnss_dns.so.2", O_RDONLY) = 3
read(3, "7ELF
MemTotal:      3916648 kB
MemFree:        501180 kB
Buffers:        335276 kB
Cached:        2312536 kB
SwapCached:          0 kB
Active:        1312888 kB
Inactive:      1702096 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      3916648 kB
LowFree:        501180 kB
SwapTotal:     3574452 kB
SwapFree:      3574292 kB
Dirty:             728 kB
Writeback:           0 kB
AnonPages:      367160 kB
Mapped:          33640 kB
Slab:           351564 kB
PageTables:      18588 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   5532776 kB
Committed_AS:  1188280 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    265828 kB
VmallocChunk: 34359471827 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=3 ID=271 PROTO=UDP SPT=10170 DPT=33437 LEN=12
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=89.39.188.210 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=117 ID=47199 DF PROTO=TCP SPT=2119 DPT=4899 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=89.39.188.210 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=117 ID=47678 DF PROTO=TCP SPT=2119 DPT=4899 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=89.39.188.210 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=117 ID=48675 DF PROTO=TCP SPT=2119 DPT=4899 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=198.60.169.59 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=116 ID=16299 DF PROTO=TCP SPT=3185 DPT=5555 WINDOW=16384 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=198.60.169.59 DST=xxx.xxx.xxx.12 LEN=48 TOS=0x00 PREC=0x00 TTL=116 ID=16300 DF PROTO=TCP SPT=3186 DPT=5555 WINDOW=16384 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=198.60.169.59 DST=xxx.xxx.xxx.12 LEN=48 TOS=0x00 PREC=0x00 TTL=116 ID=17038 DF PROTO=TCP SPT=3186 DPT=5555 WINDOW=16384 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=198.60.169.59 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=116 ID=17073 DF PROTO=TCP SPT=3185 DPT=5555 WINDOW=16384 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=188.254.224.225 DST=xxx.xxx.xxx.12 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=39888 PROTO=TCP SPT=59828 DPT=5900 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=188.254.224.225 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=43041 PROTO=TCP SPT=59828 DPT=5900 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=269 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=269 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=2 ID=270 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=2 ID=270 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=3 ID=271 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=3 ID=271 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=65.111.170.208 DST=xxx.xxx.xxx.11 LEN=444 TOS=0x00 PREC=0x00 TTL=52 ID=0 DF PROTO=UDP SPT=5105 DPT=5060 LEN=424
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=65.111.170.208 DST=xxx.xxx.xxx.12 LEN=443 TOS=0x00 PREC=0x00 TTL=52 ID=0 DF PROTO=UDP SPT=5105 DPT=5060 LEN=423
TCP: Treason uncloaked! Peer 82.129.64.220:5306/59348 shrinks window 3410313698:3410313754. Repaired.
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=223.203.192.53 DST=xxx.xxx.xxx.12 LEN=1500 TOS=0x00 PREC=0x00 TTL=47 ID=2742 PROTO=UDP SPT=0 DPT=0 LEN=44665
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - an user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to
#        - rtprio - max realtime priority
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4

# End of file
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
dan@server [~]# php
Out of memory
dan@server [~]# php test.php
Out of memory
dan@server [~]# php doesntexist.php
Out of memory
dan@server [~]# php -v
Out of memory
core file size          (blocks, -c) 200000
data seg size           (kbytes, -d) 200000
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 37888
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) 200000
open files                      (-n) 100
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 35
virtual memory          (kbytes, -v) 200000
file locks                      (-x) unlimited
             total       used       free     shared    buffers     cached
Mem:          3824       3714        110          0        142       2632
-/+ buffers/cache:        939       2885
Swap:         3490          0       3490
Mem:   3916648k total,  3797056k used,   119592k free,   145820k buffers
Swap:  3574452k total,      168k used,  3574284k free,  2686844k cached
fstat(3, {st_mode=S_IFREG|0644, st_size=100030, ...}) = 0
mmap(NULL, 100030, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2ad3ce0af000
close(3)                                = 0
open("/lib64/libnss_dns.so.2", O_RDONLY) = 3
read(3, "7ELF
MemTotal:      3916648 kB
MemFree:        501180 kB
Buffers:        335276 kB
Cached:        2312536 kB
SwapCached:          0 kB
Active:        1312888 kB
Inactive:      1702096 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      3916648 kB
LowFree:        501180 kB
SwapTotal:     3574452 kB
SwapFree:      3574292 kB
Dirty:             728 kB
Writeback:           0 kB
AnonPages:      367160 kB
Mapped:          33640 kB
Slab:           351564 kB
PageTables:      18588 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   5532776 kB
Committed_AS:  1188280 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    265828 kB
VmallocChunk: 34359471827 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=3 ID=271 PROTO=UDP SPT=10170 DPT=33437 LEN=12
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=89.39.188.210 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=117 ID=47199 DF PROTO=TCP SPT=2119 DPT=4899 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=89.39.188.210 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=117 ID=47678 DF PROTO=TCP SPT=2119 DPT=4899 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=89.39.188.210 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=117 ID=48675 DF PROTO=TCP SPT=2119 DPT=4899 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=198.60.169.59 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=116 ID=16299 DF PROTO=TCP SPT=3185 DPT=5555 WINDOW=16384 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=198.60.169.59 DST=xxx.xxx.xxx.12 LEN=48 TOS=0x00 PREC=0x00 TTL=116 ID=16300 DF PROTO=TCP SPT=3186 DPT=5555 WINDOW=16384 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=198.60.169.59 DST=xxx.xxx.xxx.12 LEN=48 TOS=0x00 PREC=0x00 TTL=116 ID=17038 DF PROTO=TCP SPT=3186 DPT=5555 WINDOW=16384 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=198.60.169.59 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=116 ID=17073 DF PROTO=TCP SPT=3185 DPT=5555 WINDOW=16384 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=188.254.224.225 DST=xxx.xxx.xxx.12 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=39888 PROTO=TCP SPT=59828 DPT=5900 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=188.254.224.225 DST=xxx.xxx.xxx.11 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=43041 PROTO=TCP SPT=59828 DPT=5900 WINDOW=65535 RES=0x00 SYN URGP=0
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=269 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=269 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=2 ID=270 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=2 ID=270 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=3 ID=271 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=93.191.199.110 DST=xxx.xxx.xxx.11 LEN=32 TOS=0x00 PREC=0x00 TTL=3 ID=271 PROTO=UDP SPT=10202 DPT=33437 LEN=12
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=65.111.170.208 DST=xxx.xxx.xxx.11 LEN=444 TOS=0x00 PREC=0x00 TTL=52 ID=0 DF PROTO=UDP SPT=5105 DPT=5060 LEN=424
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=65.111.170.208 DST=xxx.xxx.xxx.12 LEN=443 TOS=0x00 PREC=0x00 TTL=52 ID=0 DF PROTO=UDP SPT=5105 DPT=5060 LEN=423
TCP: Treason uncloaked! Peer 82.129.64.220:5306/59348 shrinks window 3410313698:3410313754. Repaired.
Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:23:ae:8f:59:78:30:37:a6:da:d2:e9:08:00 SRC=223.203.192.53 DST=xxx.xxx.xxx.12 LEN=1500 TOS=0x00 PREC=0x00 TTL=47 ID=2742 PROTO=UDP SPT=0 DPT=0 LEN=44665
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - an user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to
#        - rtprio - max realtime priority
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4

# End of file
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
%pre%%pre%%pre%%pre%%pre%%pre%>%pre%%pre%%pre%%pre%0%pre%%pre%%pre%%pre%%pre%%pre%"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=23736, ...}) = 0 mmap(NULL, 2113792, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = -1 ENOMEM (Cannot allocate memory) close(3) = 0 munmap(0x2ad3ce0af000, 100030) = 0 alarm(0) = 0 futex(0x3d80e07b20, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x3d80e079a0, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x3d7fe94760, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x3d7fe94c10, FUTEX_WAKE_PRIVATE, 2147483647) = 0 stat("/etc/krb5.conf", {st_mode=S_IFREG|0644, st_size=608, ...}) = 0 open("/proc/filesystems", O_RDONLY) = 3 read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 314 close(3) = 0 open("/etc/krb5.conf", O_RDONLY) = 3 open("/proc/filesystems", O_RDONLY) = 4 read(4, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 314 close(4) = 0 access("/etc/krb5.conf", W_OK) = -1 EACCES (Permission denied) fstat(3, {st_mode=S_IFREG|0644, st_size=608, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ad3ce0af000 read(3, "[logging]\n default = FILE:/var/l"..., 4096) = 608 read(3, "", 4096) = 0 close(3) = 0 munmap(0x2ad3ce0af000, 4096) = 0 open("/dev/urandom", O_RDONLY) = 3 fstat(3, {st_mode=S_IFCHR|0444, st_rdev=makedev(1, 9), ...}) = 0 read(3, "00co3cI\t5418gy474Z:", 20) = 20 close(3) = 0 futex(0x3d7f624640, FUTEX_WAKE_PRIVATE, 2147483647) = 0 open("/proc/filesystems", O_RDONLY) = 3 read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 314 close(3) = 0 open("/etc/krb5.keytab", O_RDONLY) = -1 ENOENT (No such file or directory) open("/proc/filesystems", O_RDONLY) = 3 read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 314 close(3) = 0 futex(0x3d8122d0c0, FUTEX_WAKE_PRIVATE, 2147483647) = 0 stat("/dev/urandom", {st_mode=S_IFCHR|0444, st_rdev=makedev(1, 9), ...}) = 0 brk(0x340b000) = 0x340b000 brk(0x342c000) = 0x340b000 mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) write(2, "Out of memory\n", 14Out of memory ) = 14 exit_group(1) = ?
%pre%>%pre%%pre%%pre%%pre%0%pre%%pre%%pre%%pre%%pre%%pre%"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=23736, ...}) = 0 mmap(NULL, 2113792, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = -1 ENOMEM (Cannot allocate memory) close(3) = 0 munmap(0x2ad3ce0af000, 100030) = 0 alarm(0) = 0 futex(0x3d80e07b20, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x3d80e079a0, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x3d7fe94760, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x3d7fe94c10, FUTEX_WAKE_PRIVATE, 2147483647) = 0 stat("/etc/krb5.conf", {st_mode=S_IFREG|0644, st_size=608, ...}) = 0 open("/proc/filesystems", O_RDONLY) = 3 read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 314 close(3) = 0 open("/etc/krb5.conf", O_RDONLY) = 3 open("/proc/filesystems", O_RDONLY) = 4 read(4, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 314 close(4) = 0 access("/etc/krb5.conf", W_OK) = -1 EACCES (Permission denied) fstat(3, {st_mode=S_IFREG|0644, st_size=608, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ad3ce0af000 read(3, "[logging]\n default = FILE:/var/l"..., 4096) = 608 read(3, "", 4096) = 0 close(3) = 0 munmap(0x2ad3ce0af000, 4096) = 0 open("/dev/urandom", O_RDONLY) = 3 fstat(3, {st_mode=S_IFCHR|0444, st_rdev=makedev(1, 9), ...}) = 0 read(3, "00co3cI\t5418gy474Z:", 20) = 20 close(3) = 0 futex(0x3d7f624640, FUTEX_WAKE_PRIVATE, 2147483647) = 0 open("/proc/filesystems", O_RDONLY) = 3 read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 314 close(3) = 0 open("/etc/krb5.keytab", O_RDONLY) = -1 ENOENT (No such file or directory) open("/proc/filesystems", O_RDONLY) = 3 read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 314 close(3) = 0 futex(0x3d8122d0c0, FUTEX_WAKE_PRIVATE, 2147483647) = 0 stat("/dev/urandom", {st_mode=S_IFCHR|0444, st_rdev=makedev(1, 9), ...}) = 0 brk(0x340b000) = 0x340b000 brk(0x342c000) = 0x340b000 mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) write(2, "Out of memory\n", 14Out of memory ) = 14 exit_group(1) = ?

EDITAR: Adicionadas saídas conforme solicitado pelo sonassi.

Todo o log está disponível no link

Saída do cat / proc / meminfo:

%pre%

A saída do cat / proc / meminfo depois de executar o php test.php está abaixo. Eu substituí o endereço IP do servidor aqui, pois é um IP público - xxx.xxx.xxx.11 é o IP principal do servidor e xxx.xxx.xxx.12 é o outro IP.

%pre%

cat /etc/security/limits.conf mostra que tudo foi comentado até onde eu sei:

%pre%

E a saída do cat /etc/sysctl.conf:

%pre%

EDITAR: Atualizado o ulimit acima para ser executado como dan, e não como root.

    
por Gnuffo1 12.03.2012 / 12:19

1 resposta

8

Depois de reler seus comentários acima e sua postagem original - você executou ulimit -a como root - mas disse que root não é afetado. / p>

Seu problema aqui é ulimit , mas no nível do usuário. Faça login como seu usuário dan e execute ulimit -a e você provavelmente achará sua memória limitada.

    
por 17.03.2012 / 00:54