I'm running Magento 2.2.2 with cpanel
I am getting this error in update.log:
--
setup-cron.ERROR: Your current PHP memory limit is 128M. 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.
--
I don't have the ability to edit the php.ini file specified in "php --ini", or restart the shared web server.
I have set memory_limit to 756M in my php.ini file, and I have specified the php.ini file location in my crontab AND I also specified the memory_limit to 756 in crontab.
-- Output of "crontab -l"
10,29,35,59 * * * * /usr/local/bin/php -c /home/chargoggagoggman/public_html --d memory_limit=756M /home/chargoggagoggman/public_html/update/cron.php >> /home/chargoggagoggman/public_html/var/log/update.cron.log
7,29,30,58 * * * * /usr/local/bin/php -c /home/chargoggagoggman/public_html -d memory_limit=756M /home/chargoggagoggman/public_html/bin/magento setup:cron:run >> /home/chargoggagoggman/public_html/var/log/setup.cron.log
12,24,43,48 * * * * /usr/local/bin/php -c /home/chargoggagoggman/public_html -d memory_limit=756M /home/chargoggagoggman/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/chargoggagoggman/public_html/var/log/magento.cron.log
--
Each time I make a change, I run "php bin/magento cron:run" twice, per a suggestion I saw in this forum
I also tried "php bin/magento setup:cron:run"
adding a phpinfo query to the home page of my website showed nothing contradictory
Suggestions, please?
Hi @PanchoCole,
Can you run this on your server console?
php -i | grep limit
The output could be, for example:
memory_limit => -1 => -1 mysql.max_links => Unlimited => Unlimited mysql.max_persistent => Unlimited => Unlimited mysqli.max_links => Unlimited => Unlimited mysqli.max_persistent => Unlimited => Unlimited pcre.backtrack_limit => 1000000 => 1000000 pcre.recursion_limit => 100000 => 100000 session.cache_limiter => nocache => nocache soap.wsdl_cache_limit => 5 => 5
Can you check which value you get on memory_limit ?
It's shared hosting. You cant use console.
I got the same issue.
Hi @Dmitriy_Komar,
Maybe is a good idea to explore another hosting options. Using Magento 2 without full access to the console it could be a bad a idea.
I can't imagine having a Magento 2 store with limitations when I need to use the console.
Hi,
I am facing the same issue. My cron is not running on scheduled times. Error on magento.cron.log:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 655360 bytes) in /var/www/vhosts/user/httpdocs/magento/generated/metadata/global.php on line 8
This is the result of my run:
-bash-4.2$ php -i | grep limit
memory_limit => 768M => 768M
Total Links => 0/unlimited
ldap.max_links => Unlimited => Unlimited
mbstring.regex_stack_limit => 100000 => 100000
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
odbc.max_links => Unlimited => Unlimited
odbc.max_persistent => Unlimited => Unlimited
pcre.backtrack_limit => 1000000 => 1000000
pcre.recursion_limit => 100000 => 100000
pgsql.max_links => Unlimited => Unlimited
pgsql.max_persistent => Unlimited => Unlimited
redis.pconnect.connection_limit => 0 => 0
session.cache_limiter => nocache => nocache
soap.wsdl_cache_limit => 5 => 5
Please help
Hi @sugaryusuf,
Please check the PHP Settings here: https://devdocs.magento.com/guides/v2.4/install-gde/prereq/php-settings.html#check-php-settings
I guess those values are not enough.
Also, check the PHP version you are using.
Cheers!
Hi,
I am using php 7.3 version. Which values are not enough?
To resolve Magento 2 memory limit errors on cPanel hosting:
Keep testing with phpinfo() after each change. With some tweaking, the limit can be increased at the account level.
It seems like you've correctly configured your cron jobs to run with an increased memory limit in your crontab. However, it's possible that these changes are not taking effect due to some other configurations or restrictions on your shared hosting environment. Here are some suggestions to troubleshoot the issue:
Check for .user.ini File: Some shared hosting providers allow you to override PHP settings using a .user.ini file in your website's root directory. Check if you have a .user.ini file in your Magento root directory and ensure that the memory_limit setting is correctly configured there. If not, create one and set the memory_limit to 756M.
Check PHP Executable Path: Make sure the path to the PHP executable in your crontab is correct. You can find the correct path by running the following command in SSH:
Use the path returned by the command in your crontab.
Check PHP Version: Ensure that you're modifying the correct PHP version's settings. Magento 2 might use a different PHP version than the default command-line PHP. Verify the PHP version for your website and make sure you are modifying the correct php.ini file.
Cron Environment Variables: Sometimes, the environment variables might not be loaded correctly when running cron jobs. To ensure that your php.ini settings are applied, you can include them directly in your cron command:
Contact Hosting Support: If you've tried the above steps and the issue persists, it's possible that your shared hosting environment has restrictions that prevent you from modifying PHP settings via cron. In such cases, reach out to your hosting provider's support team and inquire if they can increase the memory limit for your cron jobs or if there are specific configurations you should be aware of.
Remember to check the logs in /var/log for any error messages related to cron jobs or PHP settings. This can provide valuable information about what might be causing the issue.