1 |
I know this is Off-topic but I also know there are a lot of smart people |
2 |
"lurking" on this list. |
3 |
|
4 |
I have a PHP-script that does not run from a web-server but directly in a |
5 |
shell. When I run it I get the following error: |
6 |
|
7 |
# ./dj.php |
8 |
PHP Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to |
9 |
allocate 104 bytes) in /usr/local/scripts/includes/dj.inc on line 79 |
10 |
Allowed memory size of 100663296 bytes exhausted (tried to allocate 24 bytes) |
11 |
|
12 |
My scripts starts with: |
13 |
#!/usr/bin/php |
14 |
<?php |
15 |
|
16 |
ini_set('memory_limit', '4192M'); |
17 |
|
18 |
include "dj.inc"; |
19 |
|
20 |
And in php.ini I have: |
21 |
memory_limit = 1G ; Maximum amount of memory a script may consume |
22 |
|
23 |
Why does PHP not honor my memory limits? |
24 |
I have set 1GB in php.ini and 4192MB (I know that is more then 1GB) and the |
25 |
scripts fails at 100663296 bytes (~ 96MB). I have also tried with other memory |
26 |
settings but I always end up with with the failure at ~96MB. The host has |
27 |
enough RAM (32GB) to support the script. |
28 |
|
29 |
Any suggestions on how to solve the issue (short of rewriting the script in C |
30 |
or C++)? |
31 |
|
32 |
Regards, |
33 |
-- |
34 |
Dan Johansson, <http://www.dmj.nu> |
35 |
*************************************************** |
36 |
This message is printed on 100% recycled electrons! |
37 |
*************************************************** |