I am doing the attendance records for students in a school year Sept 2016- July 2017. I had set the students who started in the 3rd week of Sept 2016 and Jan 2017 to expected users with their expected start date in the system. I enrolled them to their expected form group.The question is, shouldn’t the system automatically set them to full users at the appointed start date? Or is their something I am overlooking?
Willpro, this only happens automatically if you use the User Management command line script, as described on this page. The bottom of the guide includes information on using cron to schedule the running of the script. Good luck! Ross.
Where do i put the script? in the user admin module?
Willpro, no the script should be left in /cli and run from there. How you initiate it depends on your OS (Linux uses cron for scheduled commands). Ross.
Thanks for your reply.
I am still a bit confused. I input the path to the script in /home/bxxxxx/public_html/xxxxxx/cli/userAdmin_statusCheckAndFix.php and set the schedule in cron and it’s saying: No such file or directory. What am i doing wrong?
Willpro, in my experience, and following the guide on our site, cron entries work best when first calling the directory the script is in, and then, after a ; seperator, calling the file:
0 1 * * * cd /var/www/gibbon/cli/ ; php userAdmin_statusCheckAndFix.php
Replace /var/www/gibbon/cli/ with /home/bxxxxx/public_html/xxxxxx/cli/ and it should work for you.
i tried it as you suggested : /home/bxxxxx/public_html/mxxxxxxxx/cli/ ; php userAdmin_statusCheckAndFix.php
but i am still getting this error message: /bin/bash: /home/bxxxxx/public_html/mxxxxxxxx/cli/: is a directory
Status: 404 Not Found
Content-type: text/html; charset=UTF-8
No input file specified
I also tried it these 2 ways as well (1) :/home/bxxxxx/public_html/mxxxxxxxx/cli/ ; userAdmin_statusCheckAndFix.php and I got this error:/bin/bash: /home/bxxxxx/public_html/mxxxxxxxxx/cli/: is a directory
/bin/bash: userAdmin_statusCheckAndFix.php: command not found
(2) /home/bxxxxx/public_html/mxxxxxxxx/cli/userAdmin_statusCheckAndFix.php and i got this error:/bin/bash: /home/bxxxxxx/public_html/mxxxxxxxx/cli/userAdmin_statusCheckAndFix.php: Permission denied
I don’t know what I am missing here.
I spoke to the host and they gave me this command to use: /usr/local/bin/php /home/cPanel username/public_html/path to cron.php
When i input the necessary info in like this, there are no error message: /usr/local/bin/php /home/bxxxxx/public_html//mxxxxxxxx/cli/userAdmin_statusCheckAndFix.php
However I am not sure has to how long the script takes to run and i am not seeing any output message as to the result. Checking the system I am still seeing the students as ‘expected’ and not as ‘full’ even after the time had elasped
The script should notify the main system admin (as per System Settings) when it has run. Are you seeing that notification?
Expected users are turned to full depending if their start date is set and has been equaled or passed in time. Do your expected users have their start date set?
Also, for whatever reason a cron file requires a blank line at the end of the file, otherwise it silently fails to run. Lost a bit of time to that one once
Thanks for your reply Ross/Sandra,
I have my notification set, i got all the previous error messages. The start date for the users were set for Jan 2017.
How would i put the blank line at the end of the line?
Willpro, I usually set cron up using the crontab command in Linux with the -e parameter, and it seems to do the line automatically. I suggest you check out your PHP error log as well to see if you are getting any error messages when the CLI script is running.
As far as I see error consist of the wrong path to config.php file.
I got the script /home/bxxxxx/public_html/mxxxxxxxx/cli/userAdmin_statusCheckAndFix.php updated to an absolute path to config files:
I got one notification that cli was executed but i am unable to get the script to run any further cron task. What else am i doing wrong?
In further discussion with the host they identified the following as shown here:
We have set up your cron job from official developer’s instruction.
When performing the script, we found this error:
[16-May-2017 22:49:19 America/Jamaica] PHP Warning: stream_socket_enable_crypto(): Peer certificate CN=
*.websitehostserver.net' did not match expected CN=localhost’ in /home/bxxxxxx/public_html/mxxxxxxxx/lib/PHPMailer/class.smtp.php on line 354
If your script should use SSL for SMTP connection it should connect to the hostname server but not localhost.
We recommend to contact your web-developer from regarding the issue.
I got this report from the host also:
Please check the part of error logs bellow:
[17-May-2017 15:55:03 UTC] PHP Notice: Undefined index: SERVER_PORT in /home/bxxxxxx/public_html/mxxxxxxxxxxx/src/Gibbon/core.php on line 244
[17-May-2017 15:55:03 UTC] PHP Notice: Undefined index: SERVER_PORT in /home/bxxxxxx/public_html/mxxxxxxxxxx/src/Gibbon/core.php on line 244
[17-May-2017 15:55:03 UTC] PHP Notice: Undefined index: SERVER_NAME in /home/bxxxxxx/public_html/mxxxxxxxx/src/Gibbon/core.php on line 246
[17-May-2017 18:00:01 UTC] PHP Notice: Undefined index: SERVER_PORT in /home/bxxxxxxx/public_html/mxxxxxxxxx/src/Gibbon/core.php on line 244
[17-May-2017 18:00:01 UTC] PHP Notice: Undefined index: SERVER_PORT in /home/bxxxxxx/public_html/mxxxxxxxx/src/Gibbon/core.php on line 244
[17-May-2017 18:00:01 UTC] PHP Notice: Undefined index: SERVER_NAME in /home/bxxxxxx/public_html/mxxxxxxxxx/src/Gibbon/core.php on line 246
Looks like it’s using 80 port but as far as I see the script can’t be performed via the http request. Please make sure that your script is configured correctly.
Willpro, OK, this is useful, and it is to do with the way the server is set up. Gibbon, by default, sends via localhost as it is simply and reliable…but not all servers support this, and there are some good reasons to switch over to an authenticated SMTP server. The best solution is to go to Admin > System Admin > Third Party Settings and enable SMTP Mail. You’ll need to speak to your host, or consult their documentation, in order to know how to set this up. Hope this helps. Ross.
Still at square one. Enabled smtp and configured as suggested but I am still getting the same result hsa can be seen below:
cd /home/bxxxxx/public_html/mxxxxxxxxxx/cli/ ; php userAdmin_statusCheckAndFix.php
Set-Cookie: PHPSESSID=9g14pvjelai56ljbrr2fv0o681; path=/
Content-type: text/html; charset=UTF-8
This script cannot be run from a browser, only via CLI.
I contacted the host again (greengeeks) and this is their response:
The following crontab you set up looks fine
00 14 * * * cd /home/bxxxxxx/public_html/mxxxxxxxxx/cli/ ; php userAdmin_statusCheckAndFix.php
But there are errors in your error_log file
[19-May-2017 20:17:46 UTC] PHP Notice: Undefined index: SERVER_PORT in /home/bxxxxxx/public_html/mxxxxxxxxxx/src/Gibbon/core.php on line 244
[19-May-2017 20:17:46 UTC] PHP Notice: Undefined index: SERVER_PORT in /home/bxxxxxxx/public_html/mxxxxxxxxxp/src/Gibbon/core.php on line 244
[19-May-2017 20:17:46 UTC] PHP Notice: Undefined index: SERVER_NAME in /home/bxxxxxxx/public_html/mxxxxxxxxxx/src/Gibbon/core.php on line 246
Please contact developer for farther assistance
Luckily those are just PHP notices rather than errors, they shouldn’t prevent the script from running. I tested on this end with v13 and the script runs despite the notices (which have been handled in v14).
However, your previous post I think sheds some light on the problem: the output “This script cannot be run from a browser, only via CLI.” shouldn’t be occurring if the script is being run from CLI. If you type something like
php -r ‘echo php_sapi_name()."
in the command line it should return <code class="CodeInline">cli. If not, then it’s possible the script isn’t handling this check properly for your type of server configuration.
Ross, it sounds like there are instances where php_sapi_name() might not return ‘cli’ from the command line: http://stackoverflow.com/questions/933367/php-how-to-best-determine-if-the-current-invocation-is-from-cli-or-web-server/25967493#25967493