Matthew Yarro

Registered
Oct 20, 2014
4
0
1
Lindon, Utah, United States
cPanel Access Level
Reseller Owner
I have looked and read through quit a few posts, but I just can't seem to get my cron to work.

I have tried:

/usr/local/bin/php -q public_html/cron/reset-security-codes.php

Which says it cannot open the file input

and I have tried:

/usr/local/bin/php5 -q public_html/cron/reset-security-codes.php

Which says that /usr/local/bin/php5 doesn't exist

and this:

-q /public_html/cron/reset-security-codes.php

Which results in:

public_html/cron/reset-security-codes.php: line 1: ?php: No such file or directory
public_html/cron/reset-security-codes.php: line 3: require_once: command not found
public_html/cron/reset-security-codes.php: line 4: require_once: command not found
public_html/cron/reset-security-codes.php: line 6: require_once: command not found
public_html/cron/reset-security-codes.php: line 9: =UPDATE user SET user_auto_login = 'no': command not found
public_html/cron/reset-security-codes.php: line 10: syntax error near unexpected token `$query_is'
public_html/cron/reset-security-codes.php: line 10: ` mysql_query($query_is) or die('Invalid query: ' . mysql_error());'


Which I assume means that it can find the cron file but doesn't understand it's PHP because I removed the first part of the cron equation. But when I put it in there:

/usr/local/bin/php -q public_html/cron/reset-security-codes.php

It says it cannot open the file input.

I am at a bit of a loss. Any help would be helpful and appreciated.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello :)

Yes, it looks like you are missing the "/" before public_html in the commands you referenced. Let us know if the suggested entry in the previous post is helpful.

Thank you.
 

Matthew Yarro

Registered
Oct 20, 2014
4
0
1
Lindon, Utah, United States
cPanel Access Level
Reseller Owner
Figured out a few issues that were causing the error to occur and thought I would share for anyone else pulling hair out of their head:

1). I had to change the permissions to both the folder contain the file and the file itself. They are currently set at 755 (folder) and 644 (file).

2). The pathing for PHP includes was causing an error, but it wasn't showing up in the log. Instead of using relative paths, I used a fully qualified path: /home/username/public_html/settings/settings-config.php

With all the other help--thank you--it is working like a gem.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
I am happy to see the issue is now resolved. Thank you for updating us with the outcome.