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. Nextcloud
  3. Increase Nextcloud PHP memory limit

Increase Nextcloud PHP memory limit

Scheduled Pinned Locked Moved Nextcloud
14 Posts 3 Posters 15.4k 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.
  • iamthefijI Offline
    iamthefijI Offline
    iamthefij
    App Dev
    wrote on last edited by
    #1

    I'm getting an error Apr 12 16:27:12 [Tue Apr 12 23:27:12.433970 2022] [php7:error] [pid 285] [client 172.18.0.1:57230] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 33554440 bytes) in /app/data/apps/dav/lib/CardDAV/CardDavBackend.php on line 996, and I'm trying to increase the memory limit to 1025M.

    So far I've added

    • 'memory_limit' => '1024M' to /app/data/config/config.php,
    • memory_limit=1024M to /app/data/.user.ini
    • memory_limit=1024M to /app/data/php.ini
    • PHP_MEMORY_LIMIT=1024M to /app/data/config.env

    But none of these seems to have worked. Any ideas where I should be able to make this adjustment? The server itself is already allocated to up to 1.5Gb, and the error seems to be PHP related, but I'm not sure where to set this.

    1 Reply Last reply
    0
    • iamthefijI iamthefij referenced this topic on
    • nebulonN Away
      nebulonN Away
      nebulon
      Staff
      wrote on last edited by
      #2

      Looks like you are setting it in the correct places. Adjusting /app/data/php.ini or /app/data/config/config.php might be sufficient though. Can you take a look at Nextcloud's Settings -> System on what it displays as the PHP memory limit?

      1 Reply Last reply
      0
      • nebulonN nebulon marked this topic as a question on
      • nebulonN Away
        nebulonN Away
        nebulon
        Staff
        wrote on last edited by
        #3

        So I have tried this now and setting the memory_limit in /app/data/php.ini works. But the app needs to be restarted afterwards!

        1 Reply Last reply
        1
        • nebulonN nebulon has marked this topic as solved on
        • nebulonN nebulon has marked this topic as unsolved on
        • girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #4

          The app restart is important for apache to pick up the changes.

          iamthefijI 1 Reply Last reply
          0
          • girishG girish

            The app restart is important for apache to pick up the changes.

            iamthefijI Offline
            iamthefijI Offline
            iamthefij
            App Dev
            wrote on last edited by
            #5

            @girish @nebulon I've restarted the app with all those values set and Settings > System still shows Memory Limit: 512 MB

            girishG 1 Reply Last reply
            0
            • iamthefijI iamthefij

              @girish @nebulon I've restarted the app with all those values set and Settings > System still shows Memory Limit: 512 MB

              girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #6

              @iamthefij Interesting. So, all I did was to add memory_limit=1024M in /app/data/php.ini.

              78aa3c6f-203b-4a70-8bb9-e0b63a05565d-image.png

              And then, after a restart:

              b5cead64-2738-4076-b14f-00dd28794992-image.png

              Maybe you can remove all the other changes? Can you check by removing all other configs other than this one?

              iamthefijI 1 Reply Last reply
              0
              • girishG girish

                @iamthefij Interesting. So, all I did was to add memory_limit=1024M in /app/data/php.ini.

                78aa3c6f-203b-4a70-8bb9-e0b63a05565d-image.png

                And then, after a restart:

                b5cead64-2738-4076-b14f-00dd28794992-image.png

                Maybe you can remove all the other changes? Can you check by removing all other configs other than this one?

                iamthefijI Offline
                iamthefijI Offline
                iamthefij
                App Dev
                wrote on last edited by iamthefij
                #7

                @girish I had updated the .user.ini because it had previously said memory_limit=512M, so that's why I changed it. Should I remove it or change it back? I've already removed it from everywhere else.

                girishG 1 Reply Last reply
                0
                • iamthefijI iamthefij

                  @girish I had updated the .user.ini because it had previously said memory_limit=512M, so that's why I changed it. Should I remove it or change it back? I've already removed it from everywhere else.

                  girishG Offline
                  girishG Offline
                  girish
                  Staff
                  wrote on last edited by
                  #8

                  @iamthefij Interesting. The Cloudron package does not create it and AFAIK neither does nextcloud itself. But yes, you can delete that file entirely.

                  iamthefijI 1 Reply Last reply
                  0
                  • girishG girish

                    @iamthefij Interesting. The Cloudron package does not create it and AFAIK neither does nextcloud itself. But yes, you can delete that file entirely.

                    iamthefijI Offline
                    iamthefijI Offline
                    iamthefij
                    App Dev
                    wrote on last edited by
                    #9

                    @girish deleted and restarted. Nextcloud still says 512MB but php -i shows memory_limit => 1024M => 1024M.

                    1 Reply Last reply
                    0
                    • iamthefijI Offline
                      iamthefijI Offline
                      iamthefij
                      App Dev
                      wrote on last edited by
                      #10

                      I know very little about PHP, so I'm running low on things to try. I've tried grepping through /app/code for other places where memory_limit is referenced, and I don't see anything else limiting it.

                      1 Reply Last reply
                      0
                      • nebulonN Away
                        nebulonN Away
                        nebulon
                        Staff
                        wrote on last edited by
                        #11

                        maybe you have some memory_limit leftover in some other config file. The only place to have it should be in /app/data/php.ini

                        iamthefijI 1 Reply Last reply
                        0
                        • nebulonN nebulon

                          maybe you have some memory_limit leftover in some other config file. The only place to have it should be in /app/data/php.ini

                          iamthefijI Offline
                          iamthefijI Offline
                          iamthefij
                          App Dev
                          wrote on last edited by
                          #12

                          @nebulon said in Increase Nextcloud PHP memory limit:

                          /app/data/php.ini

                          I undid everything I set, but then I grepped through /app/data and found php_value memory_limit 512M in /app/data/htaccess. It's not present in /app/data/.htaccess though. I'm confused as to why both of these exist in the first place.

                          But anyway, I commented out the lines in /app/data/htaccess, restarted and it looks like it worked!

                          Thanks for the help.

                          iamthefijI 1 Reply Last reply
                          1
                          • iamthefijI iamthefij

                            @nebulon said in Increase Nextcloud PHP memory limit:

                            /app/data/php.ini

                            I undid everything I set, but then I grepped through /app/data and found php_value memory_limit 512M in /app/data/htaccess. It's not present in /app/data/.htaccess though. I'm confused as to why both of these exist in the first place.

                            But anyway, I commented out the lines in /app/data/htaccess, restarted and it looks like it worked!

                            Thanks for the help.

                            iamthefijI Offline
                            iamthefijI Offline
                            iamthefij
                            App Dev
                            wrote on last edited by
                            #13

                            @iamthefij I should say... it worked to increase the limit. My contacts still don't load.

                            girishG 1 Reply Last reply
                            0
                            • iamthefijI iamthefij

                              @iamthefij I should say... it worked to increase the limit. My contacts still don't load.

                              girishG Offline
                              girishG Offline
                              girish
                              Staff
                              wrote on last edited by
                              #14

                              @iamthefij Is it still the same memory limit error? I would start out by disabling plugins. Do you use any ?

                              1 Reply Last reply
                              0
                              • jamesJ james marked this topic as a regular topic
                              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