Magento 2.1.8 Re-indexing Error - php

I'm new to Magento and I am having a trouble with Re-indexing.
I have checked all of the questions with re-indexing problem but my problem is different.
My Cron job is showing the following error:
Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.
I have removed the memory_limit in php.ini, but it's still the same.
My Cron Job:
***** php /home/username/public_html/update/cron.php >> /home/username/public_html/var/log/update.cron.log
Can anyone help?
The Following command:
* * * * * <path_to_php> <magento2_dir>/update/cron.php >> <magento2_dir>/var/log/update.cron.log
is giving the ouput
X-Powered-By: PHP/5.6.31
Content-type: text/html; charset=UTF-8
But. My index aren't being reindexed. I'm using Cpanel.

you need to setup proper CRON for your Magento2 Web Store:
to setup CRON you need to do following :
login via SSH to your server
edit cronjobs with this command
crontab -e
after this a text editor displays. (You might need to choose a text editor first.)
here you need to add following lines ( make sure to change paths for your enviornment )
* * * * * <path_to_php> <magento2_dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento2_dir>/var/log/magento.cron.log
* * * * * <path_to_php> <magento2_dir>/update/cron.php >> <magento2_dir>/var/log/update.cron.log
* * * * * <path_to_php> <magento2_dir>/bin/magento setup:cron:run >> <magento2_dir>/var/log/setup.cron.log
here:
<path_to_php> is usually /usr/bin/php you can find this by command which php
if you have installed php-cli than you need to assign path for php-cli here
<magento2_dir> is the Root directory for Magento2 Installation.
Following is must have CRON for Magento2
bin/magento cron:run
Ex:
* * * * * /usr/bin/php /home/username/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/username/public_html/var/log/magento.cron.log
* * * * * /usr/bin/php /home/username/public_html/update/cron.php >> /home/username/public_html/var/log/update.cron.log
* * * * * /usr/bin/php /home/username/public_html/bin/magento setup:cron:run >> /home/username/public_html/var/log/setup.cron.log
NOTE : IF you have cPanel or other Panels than you need to find cron / scheduler and setup the same there accordingly

You have to contact your server guy regarding that. They will increase the server memory limit. Or you can do on thing. First do the indexing using SSH and then try to set cron job. I hope it will help you.

Related

cron task not working in centos

I have an unknown problem like cron task is not running at all.. I have checked the cron status
# service crond status
crond (pid 30949) is running...
But task is not running, check my crontab list below
# crontab -l
* * * * * echo -e "\aBEEEP\n"
*/1 * * * * echo -e "\aBEEEP\n"
I added this, to check task is running or not. What is the issue, may be permission ??
No update in /var/log/cron
Thanks in advnace..
Where do you expect the echo output? Your terminal is not connected to this process.
to test if cron is working try, e.g.:
* * * * * touch /root/crontest
File will be created after 1 minute then.

How to run a cron job on OSX for php using MAMP

I've been at this for hours and have tried everything with no luck.
I am basically trying to run this http://docs.phpservermonitor.org/en/latest/install.html#setting-up-a-cronjob
I'm using MAMP and my localhost is a custom folder under User/username/localhost/servercheck
What I've tried so far is.
crontab -e
added */1 * * * * root /usr/bin/php /Users/clientsupport1/localhost/servercheck/cron/status.cron.php
And when I type crontab -l to see if its loaded I see the following.
*/1 * * * * root /usr/bin/php /Users/clientsupport1/localhost/servercheck/cron/status.cron.php
But the script does not run. I even tried a simple script that writes to a file. Still nothing. For some reason the cron job doesn't execute. Any ideas?
You need to call MAMP’s PHP executable, which will depend on on the version of PHP you’re running. For 7.2.1, the following below would be the proper path
*/1 * * * * /Applications/MAMP/bin/php/php7.2.1/bin/php /Users/clientsupport1/localhost/servercheck/cron/status.cron.php

Run url ervery 2 minutes using cron jobs in php ubuntu not working

i want to execute a url for every 2 min in php so i followed the steps
1) crontab -e
2)select nano editer
3)insert the line
* * * * * /usr/bin/GET http://www.gmail.com/sendMail
After saving the file I got the response
no crontab for root - using an empty one
crontab: installing new crontab
Is there any wrong with the command.
Can any one help me out.
you can use curl for hitting URL
follow following steps :
crontab -e
add following line to the file
*/2 * * * * /usr/bin/curl www.google.com
to know more about curl you can do
man curl

cronjob is not working Linux

I want a script file to run once every minute.. I've written this command.
* * * * * php -q /home/<username>/public_html/cron.php
But, this cronjob is not working. whenever, I try to open this file cron.php in browser, it works fine.
I'm using Linux OS. Is there a way to debug it in order to come to know the error?
If you're using Ubuntu as I am, use the full path.
* * * * * /usr/bin/php -q /home/<username>/public_html/cron.php
Have you added an empty line (new line) after your cronjob?
To debug:
Append 2>&1 to the end of your Crontab command. This will redirect the stderr output to the stdout. Then ensure you're logging the crontab's Unix command.
* * * * * php -q /home/<username>/public_html/cron.php; ls -la >>/var/log/cronrun 2>&1
This will capture anything from the Unix command.
A couple of additional hints: Write out the environment variables by issuing the command set with no parameters. And get the shell to echo each command with the set -x command. At the top of your script issue;
set
set -x
For cPanel, you may want to test curl (in case it's installed on your server):
curl --silent --compressed http://www.your-domain.com/cron.php
So it should look similar to: http://grabilla.com/0450d-93d93a32-02ab-457c-ac1c-d2883552a940.html#
You may also want to try removing the -q from your command and see if it helps.
* * * * * php /home/<username>/public_html/cron.php
*/1 * * * * /usr/bin/php -q /home//public_html/cron.php
Add the above line to the crontab file and run it . It will add a cronjob every minute

PHP Exec Crontab Not Doing Anything

I am trying to set up a cron job using a PHP script. This works fine on my computer running XAMPP but when I try it on my web host (Just Host) it's not adding it to the list of cron jobs. Here is the PHP code:
exec('crontab cronfile.txt');
cronfile.txt Contents:
* * * * * /usr/bin/php -q /home/-username-/public_html/cron/cron.php 1
This does however work when I add it through cPanel and I can view any cron jobs by using shell_exec('crontab -l'). Any ideas how to resolve this?
Most likely Apache is running as a different user than username, so it won't update usernames crontab file. Run the script
<?php phpinfo()
and verify which user Apache is running as.
On my system, I see the following
User/Group apache(48)/48
You should use this exec('crontab /tmp/cronfile.txt')
and it will work.
You can add every script to this file.
example:
touch /tmp/cronfile.txt
vi /tmp/cronfile.txt
* * * * * path-to-script
* * * * * path-to-script2
.
.
finally
crontab /tmp/cronfile.txt
crontab -l you will see your cron list

Categories