0

I recently hosted my website using Magento, upon setting up my cron.php i get the following output :

/home/xxx/webapps/abc/cron.php: line 1: ?php
: No such file or directory
/home/xxx/webapps/abc/cron.php: line 2: /**
: No such file or directory
/home/xxx/webapps/abc/cron.php: line 3: bin: command not found
/home/xxx/webapps/abc/cron.php: line 4: $'*\r': command not found
/home/xxx/webapps/abc/cron.php: line 5: bin: command not found
/home/xxx/webapps/abc/cron.php: line 6: $'*\r': command not found
/home/xxx/webapps/abc/cron.php: line 7: syntax error near unexpected token `('
/home/xxx/webapps/abc/cron.php: line 7: ` * This source file is subject to the Open Software License (OSL 3.0)

'

I host this on Webfaction, and it appears that this error only happen on Webfaction. My other website (using the same Magento version) which is hosted on another service runs just fine.

Even after i removed the following lines on cron.php, it still does not work:

/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    Mage
 * @package     Mage
 * @copyright  Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

I've also tried to put "shebang" just before the php opening tag like so:

#!/usr/local/bin/php

And get this result:

/usr/local/bin/php^M: bad interpreter: No such file or directory

Location of PHP

This is what happen when i run php cron.php

enter image description here

I suspect that there might be something wrong with the encoding. Can anyone help me with this ?

11
  • Please check the path to php using whereis php
    – rafal-kos
    Sep 6 '16 at 7:08
  • @rafal-kos please see my edit.
    – Jeremy
    Sep 6 '16 at 7:11
  • btw whereis php return this : php: /usr/local/bin/php /usr/local/php
    – Jeremy
    Sep 6 '16 at 7:18
  • And how you are calling this cron file? You are trying to run cron.sh or cron.php?
    – rafal-kos
    Sep 6 '16 at 7:25
  • @rafal-kos cron.sh will eventually call cron.php, since calling php cron.php is not working cron.sh is also not working.
    – Jeremy
    Sep 6 '16 at 7:26
0

How often are you trying to run the script?

Try something like this:

*/5 * * * * /bin/sh /var/www/mour/cron.sh

That should execute the cron.sh script every 5 minutes.

0

After new security patch cron.php does not work directly for that you have to add cron.sh file in your crontab that actually triggers cron.php different way and your all cron related task works

for adding cron.sh in your crontab you can use below syntax

*/5 * * * * /bin/sh magento_base_dir/cron.sh

Please try and let me know

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.