cancel
Showing results for 
Search instead for 
Did you mean: 

Adjusting memory_limit on shared hosting

Adjusting memory_limit on shared hosting

Hi

 

I wonder if someone may be able to help me at all?

 

I have Magento 2.1.3 setup on shared hosting and after much fiddling around with php.ini files the webhost has decided that Magento is seeing the global memory_limit (512MB) on the server rather than the local memory limit (2048MB). Obviously the host is unwilling to change the global memory_limit, so my question is how can I force Magento to look at the local php.ini file within my hosting?

 

I also have the same problem with the CLI as that picks up the global limit too but that's something I can deal with later!

 

Thanks for your time.


David

16 REPLIES 16

Re: Adjusting memory_limit on shared hosting

That doesn't sound right but without knowing how your provider configure their server, we won't know what is causing this. 

 

Did they provide any solution for this? A properly configured shared hosting server should prioritize the local values over the master value. 

Re: Adjusting memory_limit on shared hosting

Hi James

 

Thanks for replying, looking at a PHP info screen it shows a local and a master memory_limit. I can adjust the local memory_limit using .user.ini in this website’s folder and the master memory_limit is set by the php.ini file which is up a couple of levels in the hosting (at the top level), however what the host appears to be saying, and which makes sense I guess, is there’s a global limit applied to all of the hosting accounts on that server and that’s set as 512MB which is what Magento’s picking up.

 

What I think I need, and I’m no expert, is a line of code telling Magento to look at the local settings.

 

Thanks


David

Re: Adjusting memory_limit on shared hosting

Hello David,

 

I'm not sure how your host setup their server so they may very well be forcing your application to adhere to the global limit. 

 

What I am familiar with and what is normally done even for shared hosting is the local value should take precedence over the master value. 

 

So your host is saying that there's nothing that they can do at all? Smiley Sad

Re: Adjusting memory_limit on shared hosting

I think if I did a new support ticket and escalated it a bit I may get a more sensible answer out of them, but currently as far as they are concerned everything’s working as intended and the problem lies with Magento itself.

 

The site’s not far from going live now and to be honest it does seem to work OK at the moment on 512mb I’m just running into trouble when it comes to using the internal updater as it fails the readiness check for not having 768mb of memory.

 

I managed to do the most recent Magento update by just FTPing the files the old fashioned way, so if that’s an acceptable way of doing things I’ll just stick with it. I’m not a fan of command line stuff and when I did try the update using that it failed anyway.

 

Magento 2 has been a painful experience so far!

Re: Adjusting memory_limit on shared hosting

Another thing that you can try is to adjust the memory_limit with the .htaccess file:-

php_value memory_limit XXXXM

 

It's a long shot though seeing that your provider mainly uses .ini files but it's worth a try. 

Re: Adjusting memory_limit on shared hosting

Hi,

I am having exactly the same problem here. It's on a shared hosting account.

 

To check php configuration I uploaded a phpinfo file. 

Here is some extract from it:

Configuration File (php.ini) Path/opt/php70/lib/php
Loaded Configuration File/home/username/public_html/php.ini

 

max_execution_time1800090
max_file_uploads2020
max_input_nesting_level6464
max_input_time180180
max_input_vars40004000
memory_limit768M768M

 

Apparently when trying to use the auto upgrade through the portal, the upgrade script is looking for the memory limit, which is set through the root configuration php.ini file, for the root user, not for the shared local user.

 

I've set up the memory_limit to  768M in the user local path but I still get the error on upgrade readiness check and am unable to proceed with the upgrade.

 

Here below is the upgrade readiness check result:

*************************************

Step 2: Readiness Check

Error! You need to resolve these issues to continue.
Check Updater Application Availability

Updater application is available.

Check Cron Scripts

Cron script readiness check passed.

Notice from Setup Application Cron Script:
We recommend you schedule cron to run every 1 minute

Notice from Updater Application Cron Script:
We recommend you schedule cron to run every 1 minute

Check Component Dependency

Component dependency is correct.

PHP Version Check

Your PHP version is correct (7.0.16).

PHP Settings Check * <-- HERE IS THE RED FLAG OF THE ERROR

Your current PHP memory limit is 512M. Magento 2 requires it to be set to 756M or more. As a user with root privileges, edit your php.ini file to increase memory_limit. (The command php --ini tells you where it is located.) After that, restart your web server and try again.

PHP Extensions Check

You meet 15 out of 15 PHP extensions requirements. Show detail

*****************************

Re: Adjusting memory_limit on shared hosting

Hi,

I have EXACTLY the same issue.  My hosting provider suggested I upgrade to a more expensive service and all would be good.

When I was originally researching the issue, I found one guy who adjusted the checking script to pass the memorylimit test with a smaller amount of memory, and all was good.

Problem is, I cant refind that solution anywhere.

Anyone got a clue which script is doing the checking?

Id be happy to give editting it ago ...

Cheers

Re: Adjusting memory_limit on shared hosting

Would anyone happen to have an answer yet? This has been the biggest headache. Thank you Smiley Happy

Re: Adjusting memory_limit on shared hosting

No answer from me I’m afraid. I just gave up on it and hoped my client went out of business so I wouldn’t have to deal with it again!