Fatal error: Allowed memory size of 33554432 bytes exhausted ... just tried to upload a 900kb pictur


I tried to upload a "little" picture (0.9MB) to my new wordpress blog (newest version, plain install with studio theme, membership plugin). It is just a day old ... so not much on it.

When uploading this picture I get this error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 491520 bytes) in ......./wp-includes/class-simplepie.php on line 4186

(I also played with the buddy press plug in but I never got it working - it gives me these errors a lot ... so I deactivated it again and it was fine). There are already a few pictures on it which are fine.

I googled a little and think I have a php memory problem (not really sure ... haha)

Here is what I found:

A) I create a file with the name ‘php.ini’ in the directory where your WordPress site is installed. In that just add the command memory_limit = 64M in it to increase the Memory Limit to 64 MB. No success.

B) I added a htaccess file with the following line: php_value memory_limit 64 No success. I even got only a Server error 500 ... so I had to remove this line again.

C) I added define('WP_MEMORY_LIMIT', '64M'); in my ‘wp-config.php’ file ... no success.

What else can I do? Or is it maybe something else ... ???
Do I need to do something after I changed the files ... restart it or something ...
Not sure if I have access to my php.ini file and where to find it?

Next thing I would do is to contact my Hoster to have a look at it ...

  • Mason
    • DEV MAN’s Sidekick


    First off, let's check and make sure you actually have the 64M there. You can do this by creating a phpinfo file:

    After we've verified it's working you'll want to delete that file. You can also ask your hosting provider about it.

    Additionally, if you're running multisite I'd recommend 128M or even 256M with several plugins. The php.ini file should be at the root of your WordPress install.

    Let us know. Thanks!

  • miss2s
    • Flash Drive

    Hello masonjames,

    thanks for your help.

    I checked the phpinfo file I created ... wow ... a lot of information.

    The memory limit was on 64M and I changed now the php.ini and wp-config.php to 256M. Looks like it worked. The phpinfo file shows now 256M :slight_smile:.

    But my problem is still there. I tried to upload a picture and while "crunching" it I get this memory error - even with 256M. After I get this error the picture is uploaded ... but the crunching in different sizes did not work.

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 4036 bytes) in /home/flirtas1/public_html/souriandreas/wp-includes/media.php on line 254

    So looks like I have some other problem? :slight_frown:

    Here is the table were I found the memory limit (PHP Core):
    PHP Core

    Directive Local Value Master Value
    allow_call_time_pass_reference On On
    allow_url_fopen On On
    allow_url_include Off Off
    always_populate_raw_post_data Off Off
    arg_separator.input & &
    arg_separator.output & &
    asp_tags Off Off
    auto_append_file no value no value
    auto_globals_jit On On
    auto_prepend_file no value no value
    browscap no value no value
    default_charset no value no value
    default_mimetype text/html text/html
    define_syslog_variables Off Off
    detect_unicode On On
    disable_classes no value no value
    disable_functions no value no value
    display_errors On On
    display_startup_errors Off Off
    doc_root no value no value
    docref_ext no value no value
    docref_root no value no value
    enable_dl On On
    error_append_string no value no value
    error_log no value no value
    error_prepend_string no value no value
    error_reporting no value no value
    expose_php On On
    extension_dir /usr/lib/php/extensions/no-debug-non-zts-20060613 /usr/lib/php/extensions/no-debug-non-zts-20060613
    file_uploads On On
    highlight.bg #FFFFFF #FFFFFF
    highlight.comment #FF8000 #FF8000
    highlight.default #0000BB #0000BB
    highlight.html #000000 #000000
    highlight.keyword #007700 #007700
    highlight.string #DD0000 #DD0000
    html_errors On On
    ignore_repeated_errors Off Off
    ignore_repeated_source Off Off
    ignore_user_abort Off Off
    implicit_flush Off Off
    include_path .:disappointed:usr/lib/php .:disappointed:usr/lib/php
    log_errors Off Off
    log_errors_max_len 1024 1024
    magic_quotes_gpc On On
    magic_quotes_runtime Off Off
    magic_quotes_sybase Off Off
    mail.force_extra_parameters no value no value
    max_execution_time 30 30
    max_file_uploads 20 20
    max_input_nesting_level 64 64
    max_input_time -1 -1
    memory_limit 256M 256M
    open_basedir no value no value
    output_buffering 0 0
    output_handler no value no value
    post_max_size 8M 8M
    precision 14 14
    realpath_cache_size 16K 16K
    realpath_cache_ttl 120 120
    register_argc_argv On On
    register_globals Off Off
    register_long_arrays On On
    report_memleaks On On
    report_zend_debug On On
    safe_mode Off Off
    safe_mode_exec_dir /usr/local/php/bin /usr/local/php/bin
    safe_mode_gid Off Off
    safe_mode_include_dir no value no value
    sendmail_from no value no value
    sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
    serialize_precision 100 100
    short_open_tag On On
    SMTP localhost localhost
    smtp_port 25 25
    sql.safe_mode Off Off
    track_errors Off Off
    unserialize_callback_func no value no value
    upload_max_filesize 2M 2M
    upload_tmp_dir no value no value
    user_dir no value no value
    variables_order EGPCS EGPCS
    xmlrpc_error_number 0 0
    xmlrpc_errors Off Off
    y2k_compliance On On
    zend.ze1_compatibility_mode Off Off

  • miss2s
    • Flash Drive

    I investigated this a little further and found in my c-panel in the Software/Services section called PHP Configuration.

    There is mentioned:
    Resource Limits memory_limit Maximum amount of memory a script may consume (32MB) 32M

    So even if I created the php.ini and changed the ‘wp-config.php’ file and get the correct result via the phpinfo file I might still have only 32M ? Could it be that the phpinfo file displays that information wrong? Or maybe that is just the standard setting and I changed it successfully ... mhhh ...

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.