Closed jimlongo56 closed 4 years ago
It looks like problems in PHP CLI, run this script via WWW and CLI and attach the results. https://github.com/YetiForceCompany/YetiForceScripts/blob/master/TestRequirements/ConfReportTest.php the script generates the file: ConfReportTest_cron.html or ConfReportTest_www.html
run in the same way as you call the cron
copy to /home/yeti/public_html/public_html/ConfReportTest.php
Run as CLI returns nothing
root@vps [~]# php /home/yeti/public_html/ConfReportTest.php
however did find this when I run via CLI
root@vps [/]# cat /home/error_log
[18-Jun-2020 13:35:13 UTC] PHP Fatal error: Uncaught Error: Class 'App\Utils\ConfReport' not found in /home/yeti/public_html/ConfReportTest.php:25
Stack trace:
#0 {main}
thrown in /home/yeti/public_html/ConfReportTest.php on line 25
When I Run via WWW I get this output on screen with the attached file generated.
snipped because it has no importance in the story
5.58375
The script does not work, cron does not work properly, it means that you call it wrong or something is wrong with the php configuration in CLI
something?
try cd _CRM_DIR and run php ConfReportTest.php or /usr/local/bin/php ConfReportTest.php
root@vps [/home/yeti/public_html]# php ConfReportTest.php
snipped because it's irrelevant
<hr/> <hr/>0.67552 <hr/>root@vps [/home/yeti/public_html]#
P.S. I only get it to run if I'm in the _CRM folder.
IOW from ~ folder = nothing root@vps [~]# php /home/yeti/public_html/ConfReportTest.php
from /home/yeti/public_html/ = returns data [/home/yeti/public_html]# php /home/yeti/public_html/ConfReportTest.php
Surely you have a problem with file permissions, not all files have the correct owner. Improve this recursion. You run CRON from the root user and it can't be done, it must be the same as the owner of the CRM files and the WWW server, e.g. www-data
okay made sure all files are owned by the same user:group
sudo chown -R yeti:yeti /home/yeti/public_html/
still don't see why root
can't run this file.
root@vps [/]# whoami
root
root@vps [/]# php /home/yeti/public_html/ConfReportTest.php
root@vps [/]#
Is this because these crons are in the main crontab file?
*/5 * * * * sh /home/yeti/public_html/cron/cron.sh > /home/yeti/public_html/cache/logs/cron.log 2>&1
*/5 * * * * php /home/yeti/public_html/cron.php > /home/yeti/public_html/cache/logs/cron.log 2>&1
*/5 * * * * cd /home/yeti/public_html/; /usr/local/bin/php -f cron.php > /home/yeti/public_html/cache/logs/cron.log 2>&1
sudo -u yeti php /home/yeti/public_html/ConfReportTest.php
thanks @vovpff
attachment at end.
root@vps [/]# sudo -u yeti php /home/yeti/public_html/ConfReportTest.php
Content-type: text/html; charset=UTF-8
snipped because it's meaningless . . .
<hr/> <hr/>0.54949 <hr/>root@vps [/]#
@jimlongo56 no problem
@jimlongo56 i have the same problem.. this error comes once in a while every 4- 8 day.. any solutions man...
run the cron in the same way
@mariuszkrzaczkowski okay a little too cryptic for me.
Do you mean that all these crons should be in crontab -u yeti
?
*/5 * * * * sh /home/yeti/public_html/cron/cron.sh > /home/yeti/public_html/cache/logs/cron.log 2>&1
*/5 * * * * php /home/yeti/public_html/cron.php > /home/yeti/public_html/cache/logs/cron.log 2>&1
*/5 * * * * cd /home/yeti/public_html/; /usr/local/bin/php -f cron.php > /home/yeti/public_html/cache/logs/cron.log 2>&1
Because using sudo - u yeti
in the root crontab sounds odd.
You need to run php from site owner user. You can put this to cron.sh
@vovpff , so:
*/5 * * * * sudo -u yeti php /home/yeti/public_html/cron.php > /home/yeti/public_html/cache/logs/cron.log 2>&1
in the root crontab?
I've also changed cron.sh to contain the exact correct path for this account. export USE_PHP=/usr/local/bin/ea-php72
and the last cron to also use that php explicitly.
*/5 * * * * cd /home/yeti/public_html/; /usr/local/bin/ea-php72 -f cron.php > /home/yeti/public_html/cache/logs/cron.log 2>&1
Is the cron done to the end? you can call this via the url
Is the cron done to the end? How would I know this?
you can check it from the panel https://gitdeveloper.yetiforce.com/index.php?module=CronTasks&parent=Settings&view=List
and in the database
https://github.com/YetiForceCompany/YetiForceCRM/issues/13190#issuecomment-646796591 seems to have fixed things.
Have not seen the error since then.
In other words, be very careful with which user and which PHP you are calling on a multi-php cPanel server
Hello, every few days I wake up to find (or told by staff) about this error manifested usually in the following error displayed on the admin pages.
Here is my config report and some more information.
Additional NOTES: Have also seen the following error reported by cron occasionally, don't think it is directly related, but not sure about that yet.
As a fix, have moved the /app_data/cron.php file out of the way and let it be rebuilt. Here are examples of "bad" cron files, along with the latest good one. Also attached the
error_log
Archive.zip