Blesta Addons Posted June 25, 2016 Report Posted June 25, 2016 i want to run cronjob with https . my actual cron is */5 * * * * /usr/bin/php /home/xxxxxxx/public_html/index.php cron i have a custom cron that need to be run in https version , i have a model that need to check for https and the server host $this->base_url = "http" . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off" ? "s" : "") . "://" . (isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : nul) . "/"; this code always generate a http with empty server http:/// i have tweked it to be $this->base_url = "http" . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off" ? "s" : "") . "://" . (isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : $system_company->hostname) . "/"; but i still need to check http or https as every protocol has a defirenet function to run . Quote
0 Paul Posted June 28, 2016 Report Posted June 28, 2016 I'm guessing this isn't the answer you're looking for, but in the off chance - /usr/bin/wget -q https://www.yourdomain.com/blesta/cron/?cron_key=CRONKEY >/dev/null 2>&1 If you're trying to determine whether the cron is being accessed via HTTPS or not, you will not be able to determine this via CLI. If you execute your cron in the manner mentioned above, then the $_SERVER["HTTPS"] global should be present. Just not via CLI. Michael and Blesta Addons 2 Quote
0 Adam Posted June 27, 2016 Report Posted June 27, 2016 I am confused by this whole post. i want to run cronjob with https . my actual cron is */5 * * * * /usr/bin/php /home/xxxxxxx/public_html/index.php cron What is wrong with the above setup? It does not use http or even https -- looks secure to me. -Adam Quote
0 Blesta Addons Posted June 28, 2016 Author Report Posted June 28, 2016 I am confused by this whole post. What is wrong with the above setup? It does not use http or even https -- looks secure to me. -Adam The cron is running in http mode nad not https . Quote
0 Adam Posted June 28, 2016 Report Posted June 28, 2016 The cron is running in http mode nad not https . The cronjob you posted above: i want to run cronjob with https . my actual cron is */5 * * * * /usr/bin/php /home/xxxxxxx/public_html/index.php cron Does not use http or even https. So I am confused to what you are saying. What is your question / issue? Thanks, -Adam Quote
0 Blesta Addons Posted June 28, 2016 Author Report Posted June 28, 2016 The cronjob you posted above: Does not use http or even https. So I am confused to what you are saying. What is your question / issue? Thanks, -Adam The question is very clear . How to make the cronjob run in https mode rather than normal mode http . Quote
0 cloudrck Posted June 28, 2016 Report Posted June 28, 2016 The question is very clear . How to make the cronjob run in https mode rather than normal mode http . This question actually doesn't make sense. Cron has nothing to do with HTTP/S. Cron is a job scheduler, it doesn't care what your script does and it has nothing to do with any protocol. So there is no https or http mode for cron. The problem is either with PHP or your webserver. It's difficult to help since I don't understand what your script is supposed to do. i have a model that need to check for https and the server host $this->base_url = "http" . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off" ? "s" : "") . "://" . (isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : nul) . "/"; It looks like you're reading headers from a remote request. Where is this request coming from? Is it coming from a load balancer? Load balancers will sometimes move the variable you're looking for into a different header. Depending on your webserver you may have to check if the connection is over port 443. Also, try checking if the $_SERVER["HTTPS"] is not empty rather than isset. Quote
0 Blesta Addons Posted June 28, 2016 Author Report Posted June 28, 2016 I'm guessing this isn't the answer you're looking for, but in the off chance - /usr/bin/wget -q https://www.yourdomain.com/blesta/cron/?cron_key=CRONKEY >/dev/null 2>&1 If you're trying to determine whether the cron is being accessed via HTTPS or not, you will not be able to determine this via CLI. If you execute your cron in the manner mentioned above, then the $_SERVER["HTTPS"] global should be present. Just not via CLI. Thanks Paul, that is what i'm searching . Paul 1 Quote
Question
Blesta Addons
i want to run cronjob with https . my actual cron is
i have a custom cron that need to be run in https version , i have a model that need to check for https and the server host
this code always generate a http with empty server
i have tweked it to be
but i still need to check http or https as every protocol has a defirenet function to run .
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.