Score:-1

Status: 500 Internal Server Error

br flag

I run /path/to/drush/drush status from the shell just fine, but if I run it from a script called from cron I get this error.

Status: 500 Internal Server Error
Content-type: text/html; charset=UTF-8

This implies that PHP CGI is being called rather than CLI. It looks like an environment issue. How do I resolve it?

Running Drush with --debug gives the same result (no extra output from Drush). The cron user is the same as the shell user; the OS is Linux.

cn flag
Might be a long shot, but certain config files, like `~/.bash_profile`, aren't sourced for cron jobs, so I'd check whether the path to PHP and/or drush is being provided to your shell user via an export in one of those files. That might explain the difference in PHP versions. If that is the problem, `~/.profile` is usually always processed for cron jobs, so you can add appropriate `PATH` exports in there
Jaypan avatar
de flag
What's the error?
jons avatar
br flag
Using a different full path for drush worked, but then I ran into need to set trusted_host_patterns in settings.php to include the hosters `hostname`. So drush still running in CGI rather than CLI mode when called from cron. I think my hoster is using php8 by default, but Drupal is set to 7.3 in .htaccess, but I'm not aware this would make a difference.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.