friendica / friendica

Friendica Communications Platform
https://friendi.ca
GNU Affero General Public License v3.0
1.42k stars 333 forks source link

Cron Path Not found error two possible solutions #13138

Closed davidspring closed 1 year ago

davidspring commented 1 year ago

I would like to post this solution here in case others in the future have a similar problem. I have been installing several friendica test websites all using Friendica version 2023.04-1 with PHP 8.1. After setting up a cron job with the correct path and command, I would occasionally, start receiving emails with the following error: /bin/sh: 1: cd /home/username/web/your.website.com/public_html: not found /bin/sh: 1: /usr/bin/php: not found. After some research, I found that the free open source control panel I was using, called Hestia CP, had three different PHP versions that were causing come confusion for the cron command. The first version, set in the Hestia admin settings configuration panel was the system version. In some of my Virtual Private Servers, this was set for PHP 7.4. I needed to change this to PHP 8.1. In addition, each Hestia User has their own PHP setting under Advanced Options. This is called PHP CLI version and also needs to be set for 8.1. This is because the Friendica cron job is actually run using the Command Line Interface. Finally, each domain name can also be set to their own version of PHP in the domain name advanced options. This also needs to be set to PHP 8.1. In short, if I fail to make sure that all three versions are set for PHP 8.1, the cron job fails and I get the above error – even though the actual path is correct. I was therefore successful in installing Friendica with Hestia until today when I started getting the same error emailed to me again – even though the PHP versions were correct and the path was correct. What I noticed was that the Friendica installation sending the error installations had taken a long time to finish at the second to last step of the installation wizard… This is the step after entering your Admin email address and setting your time zone. It took several minutes to complete – but did result in the final step displaying with the blue link to register an admin account. The reason this step took so long to complete is that this is the step that installs the database and Friendica has quite a large database to install. I wondered if perhaps the database did not fully install - and thus the cron error was related to a problem with the database. I therefore deleted the Hestia user and bad database and created a new user with a new database and went through the install process again – only this time, at the Installation Wizard second to final step, instead of using my WIFI connection, I made sure to connect with an Ethernet cable – which is about 10 times faster than my WIFI connection. This time, there was no problem with the Cron command and I did not get any emails with the Not found error. I realize there may have been other problems with the bad installation that could have also caused this problem. In any case, if you get the Cron Not Found error, you may want to consider deleting the database and starting with a new install after making sure your PHP versions are all correct and also while being connected to an Ethernet cable instead of slow WIFi.

MrPetovan commented 1 year ago

Thank you for the write-up!