DirectAdmin + OpenLiteSpeed. PHP running out of memory

Hello.

I'm getting this errors despite I've increased PHP's memory_limit:

PHP Fatal error: Out of memory (allocated 10485760) (tried to allocate 40960 bytes) in...

Server has enough memory.

I'm running DA + OLS + PHP 7.4 + MariaDB. Wordpress with OLS Cache.

I've read about soft and hard memory limit, but documentation says panel is read-only.

Comments

  • When you say you've increased the memory limit, have you confirmed it's being reflected at a website level? I've had cases of this before where it was meant to have changed but the end site was still seeing the old value?

  • mikhomikho AdministratorHosting ProviderOG

    Often there is one service that wasn't restarted or failed to reload the configuration when this kind of problem happens after a configuration change.

  • Maybe same issue/bug we discovered, @MikePT ?
    Got that error despite having lots of free mem ... :p

  • What version of OLS are you running?

  • @Mr_Tom said:
    When you say you've increased the memory limit, have you confirmed it's being reflected at a website level? I've had cases of this before where it was meant to have changed but the end site was still seeing the old value?

    Ok this is crazy. I thought the setting was being applied but no.

    memory_limit is:

    • Inside Wordpress: 256MB
    • Outside Wordpress but same dir (php_info() in custom .php file): 128MB
    • Current php.ini value 64MB (for testing purposes)

    I can't see any .htaccess or .user.ini making changes for the directory of the domain. php_info() confirms I'm editing the correct file.

  • mikhomikho AdministratorHosting ProviderOG
  • From the DA control panel you can change the php.ini setting and it will rewrite the domain OLS config file

  • imokimok OG
    edited February 2021

    @mikho said:
    reload php?

    Already done that.

    @LeonDynamic said: From the DA control panel you can change the php.ini setting and it will rewrite the domain OLS config file

    I can't find that section in DA.

    I saw an update for PHP under CustomBuild and I did it. New memory_limit has been applied correctly.

    Strange.

  • [STDERR] PHP Fatal error: Out of memory (allocated 2097152) (tried to allocate 20480 bytes)

    Errors not fixed yet :(

  • I don't know about OLS but on my DA server as an end user it's under Extra Features > Select PHP version then within the PHP selector there's an "Options" tab which has the memory limit value in there. This may well be limited by reseller/admin values.

  • I don't have that option. That PHP selector sounds like CloudLinux. I'm using CentOS 7.

  • To reload php.ini I have to rebuild PHP :O Whhyyy?

  • MewMew
    edited February 2021

    @imok said:
    Server has enough memory.

    How do you know this? (Just to make sure there is memory available.)

    Anyways, there is a php.ini setting under custom build > edit config.
    You can also check if you get the same error with another php version or rebuild php.

    And there were some issues with PHP 7.3+ and OLS on DA since 8.0 was added iirc.

  • Even with memory_limit = 512MB I can see OOM logs.

    @Mew said: How do you know this? (Just to make sure there is memory available.)

    Just a general view from htop.

    @Mew said: Anyways, there is a php.ini setting under custom build > edit config.

    Nothing. I can edit the php.ini via terminal but new config takes effect only after I rebuild PHP.

  • Is it not under update software configuration?

  • MichaelCeeMichaelCee Hosting ProviderOGServices Provider

    @Mr_Tom said:
    Is it not under update software configuration?

    "Update PHP configuration files: Updates php.ini configuration files used by PHP. WARNING: Any customizations done will be lost."

  • @SmallWeb said:

    @Mr_Tom said:
    Is it not under update software configuration?

    "Update PHP configuration files: Updates php.ini configuration files used by PHP. WARNING: Any customizations done will be lost."

    That's for restoring default config.

  • cybertechcybertech OGBenchmark King
    edited February 2021

    do you have a pm.max_children="xx" some where?

    edit: alright maybe unrelated

    I bench YABS 24/7/365 unless it's a leap year.

  • @cybertech said:
    do you have a pm.max_children="xx" some where?

    edit: alright maybe unrelated

    It applies for php-fpm. OLS uses lsphp

  • MichaelCeeMichaelCee Hosting ProviderOGServices Provider

    @imok said:

    @SmallWeb said:

    @Mr_Tom said:
    Is it not under update software configuration?

    "Update PHP configuration files: Updates php.ini configuration files used by PHP. WARNING: Any customizations done will be lost."

    That's for restoring default config.

    Yes, I was telling @Mr_Tom

    Thanked by (1)Mr_Tom
  • @imok said:
    To reload php.ini I have to rebuild PHP :O Whhyyy?

    I've checked another server (without DA) and it looks like lsphp is running in detached mode by default. So reloading OLS won't restart lsphp, I have to do it manually. I will have to change that config on the DA server too.

    It does not explain the OOM though.

  • @imok said:
    I've read about soft and hard memory limit, but documentation says panel is read-only.

    If you want to increase the hard and soft memory limits, you will need to make the changes in the httpd-phplimits.conf file. Follow these commands to make a carbon copy of the file in the custom folder.

    cd /usr/local/directadmin/custombuild/
    mkdir -p custom/openlitespeed/conf
    cp -p configure/openlitespeed/conf/httpd-phplimits.conf custom/openlitespeed/conf/
    nano /usr/local/directadmin/custombuild/custom/openlitespeed/conf/httpd-phplimits.conf
    

    Then you will need to edit the memSoftLimit and memHardLimit to your choosing. For example, you can change the default from 2047M to 3047M.

    memSoftLimit                    3047M
    memHardLimit                    3047M
    

    Once you have made the changes rebuild the vhost config files using the ./build rewrite_confs command. Once you have rebuilt the vhosts, log into your OLS dashboard and select Server Configuration > External Applications. Now check lsphpwebapps, lsphp74 and they will have changed to 3047M for the memSoftLimit and memHardLimit.

    @LeonDynamic said:
    What version of OLS are you running?

    What version of OLS are you using 1.7 or 1.6?

    @LeonDynamic said:
    From the DA control panel you can change the php.ini setting and it will rewrite the domain OLS config file

    I am assuming that you have already adjusted the domains php.ini settings under Account Manager > PHP Settings? Note: this option isn't available from the admin dashboard only the user (domain) dashboard

  • @LeonDynamic said: Then you will need to edit the memSoftLimit and memHardLimit to your choosing. For example, you can change the default from 2047M to 3047M.

    Thank you very much. Let's see in a few hours if the change prevents the OOM logs.

    @LeonDynamic said: What version of OLS are you using 1.7 or 1.6?

    Sorry I missed your question earlier. I'm running OpenLiteSpeed (DirectAdmin Edition) 1.7.9

    @LeonDynamic said: I am assuming that you have already adjusted the domains php.ini settings under Account Manager > PHP Settings? Note: this option isn't available from the admin dashboard only the user (domain) dashboard

    I don't have any override here, yet. Didn't know about this section.

  • There was an memory issue with caching on OLS v1.7.8 that might have been the issue.

    Have you had any issues since?

  • I can't see OOM logs anymore. Not sure if memSoftLimit/memHardLimit or updating fixed the issue.

    But it works fine now.

  • @imok said:
    I can't see OOM logs anymore. Not sure if memSoftLimit/memHardLimit or updating fixed the issue.

    But it works fine now.

    Good news. If you have anymore issues with OLS or need to customise the OLS config files give me a shout. Happy to help out if possible.

    Thanked by (1)imok
Sign In or Register to comment.