SnapShooter Backups Server, Database, Application and Laravel Backups - Get fully protected with SnapShooter

CakePHP file not found when running cron shell

When working with CakePHP cake console, we had an issue, which is that it says "No such file or directory" when we tried to run the cake console .

Scenario

We were developing a CakePHP project under Windows OS, and everything is working fine in Windows and we were able to run Cake console successfully. However after we moved the application to our live server, when we tried to run Cake console to generate the database tables, it says "No such file or directory", which looks like the file lib/Console/cake is missing, but it was there.

Solution

After some research online, we found that, In Windows the end of a line is denoted by CRLF (Carriage-Return, Line-Feed). In Unix-like systems, the end of a line is donated by a single LF. This means we accidentally opened lib/Console/cake file under Windows, and it caused the problem in Unix

Simply run the command below to fix the issue:

sed -i 's/{ctrl-v}{ctrl-m}//g' [path-to-the-file]

The end

Hopefully this simple tip helped you with your development. If you like our post, please follow us on Twitter and help spread the word. We need your support to continue. If you have questions or find our mistakes in above tutorial, do leave a comment below to let us know.