Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. WordPress (Developer)
  3. Where is memory_limit and wp_memory_limit set?

Where is memory_limit and wp_memory_limit set?

Scheduled Pinned Locked Moved Solved WordPress (Developer)
wordpressmemory
8 Posts 3 Posters 1.8k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d19dotcaD Offline
      d19dotcaD Offline
      d19dotca
      wrote on last edited by girish
      #1

      Hi guys,

      I'm a little confused and could use some help. I feel like this may be something obvious that I'm just not seeing right now.

      I was trying to make sure all my sites have 256M for wp_memory_limit (to meet a recommendation from a plugin), and I see from the documentation that that value is automatically set to match the memory_limit value in /app/data/php.ini. However this is not the behaviour I see at all.

      In my /app/data/php.ini, the memory_limit is set to 128M, but WordPress shows 256M still. Why? I Mean this is the value I want, but I don't understand how it's set at 256M already when I never set it to it. At first I thought this may be related to the resources allocated to the app itself (the WP app had 256 MB assigned) and I tried increasing to 512 MB and 1 GB as a test, and it still showed 256M as the wp_memory_limit, despite memory_limit in php.ini still set as 128M and the Cloudron app itself being allocated 512 or 1 GB, so this doesn't seem related at all to the actual app memory, but I can't figure out where it's coming from still since it doesn't match what's in the php.ini file.

      Any ideas where this 256M is being used? I even tried to find it by doing a grep in /home/yellowtent/appsdata/*/data/php.ini but can't actually see 256M set anywhere, even if not looking specifically at the php.ini file using grep - still nothing. I also tried searching in git.cloudron.io for the various WordPress apps, but couldn't find this mentioned anywhere in the repository. I also checked the .htaccess file and wp-config.php file, still nothing showing 256 set anywhere.

      Screenshot from the WordPress Site Health tool showing the 256M value for memory (ignore the high 1G values for max sizes for posts and files, I intend on changing all of those soon, it was for one site with very large media files, haha):
      482c49d4-925d-43b1-bccd-835cb8236f43-image.png

      --
      Dustin Dauncey
      www.d19.ca

      1 Reply Last reply
      0
      • nebulonN Offline
        nebulonN Offline
        nebulon
        Staff
        wrote on last edited by
        #2

        Hi,

        actually it seems our documentation for the app is outdated when it comes to the memory setting. Especially the unmanaged wordpress flavor does not automatically adjust the memory limit according to the limit set from Cloudron. So to set this explicitly you have to overwrite the default (256MB) to your intended value.
        To do this add the following line to the config file at /app/data/public/wp-config.php

        define( 'WP_MEMORY_LIMIT', '256M' );
        

        Have to check if it makes sense to adjust this automatically or fix the documentation.

        d19dotcaD 1 Reply Last reply
        1
        • nebulonN nebulon

          Hi,

          actually it seems our documentation for the app is outdated when it comes to the memory setting. Especially the unmanaged wordpress flavor does not automatically adjust the memory limit according to the limit set from Cloudron. So to set this explicitly you have to overwrite the default (256MB) to your intended value.
          To do this add the following line to the config file at /app/data/public/wp-config.php

          define( 'WP_MEMORY_LIMIT', '256M' );
          

          Have to check if it makes sense to adjust this automatically or fix the documentation.

          d19dotcaD Offline
          d19dotcaD Offline
          d19dotca
          wrote on last edited by d19dotca
          #3

          @nebulon Interesting, okay. Good to know. My preference would be the same behaviour as the managed WordPress app, where it just uses the same value set in php.ini. I assume that'd help keep things more straightforward.

          Odd that it chooses 256M by default (I assume that's what it does, because there's nothing set at 256M in the files).

          --
          Dustin Dauncey
          www.d19.ca

          1 Reply Last reply
          0
          • nebulonN Offline
            nebulonN Offline
            nebulon
            Staff
            wrote on last edited by
            #4

            I've updated our docs at https://cloudron.io/documentation/apps/wordpress-unmanaged/#memory-limits to explain this all a bit better.

            d19dotcaD 1 Reply Last reply
            1
            • nebulonN nebulon

              I've updated our docs at https://cloudron.io/documentation/apps/wordpress-unmanaged/#memory-limits to explain this all a bit better.

              d19dotcaD Offline
              d19dotcaD Offline
              d19dotca
              wrote on last edited by
              #5

              @nebulon Is it possible to configure WordPress Unmanaged to just reflect the settings in php.ini? Seems odd it wouldn't be mapped to that when it picks up other php.ini changes such as the max upload size, etc. I'd prefer not to have to update memory in two different places when it seems avoidable.

              --
              Dustin Dauncey
              www.d19.ca

              1 Reply Last reply
              0
              • girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #6

                @d19dotca WordPress will always set the memory limit to 40MB See https://codex.wordpress.org/it:Modificare_wp-config.php#Increasing_memory_allocated_to_PHP . There is no way to make it follow php.ini settings afaik.

                d19dotcaD 1 Reply Last reply
                0
                • girishG girish

                  @d19dotca WordPress will always set the memory limit to 40MB See https://codex.wordpress.org/it:Modificare_wp-config.php#Increasing_memory_allocated_to_PHP . There is no way to make it follow php.ini settings afaik.

                  d19dotcaD Offline
                  d19dotcaD Offline
                  d19dotca
                  wrote on last edited by
                  #7

                  @girish I don’t know if that’s really accurate. I say that only because according to the WordPress server status page, it shows my memory set at 256M, but I don’t have that set anywhere in any files. And when I assumed it was matching the memory assigned to the whole app deployment, it was not excuse when it set it to 1 GB as a test, it still showed 256M.

                  --
                  Dustin Dauncey
                  www.d19.ca

                  1 Reply Last reply
                  0
                  • d19dotcaD d19dotca referenced this topic on
                  • d19dotcaD Offline
                    d19dotcaD Offline
                    d19dotca
                    wrote on last edited by
                    #8

                    FYI - related discussion: https://forum.cloudron.io/topic/5960/setting-memory_limit-dynamically-in-wordpress-developer-package

                    --
                    Dustin Dauncey
                    www.d19.ca

                    1 Reply Last reply
                    0
                    • d19dotcaD d19dotca referenced this topic on
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search