drupal Failed to fetch available update data的错误处理方法

zhangzhijun 2025-04-10 13:56:44 152次浏览 152个评论

安装drupal后,后台进行升级的时候出现了Failed to fetch available update data的错误,错误描述如下: See PHP OpenSSL requirements in the Drupal.org handbook for possible reasons this could happen and what you can do to resolve them.Check your local system logs for additional error messages. 通过查看system logs,发现日志中提示连接超时,日志描述如下:...

安装drupal后,后台进行升级的时候出现了Failed to fetch available update data的错误,错误描述如下:

See PHP OpenSSL requirements in the Drupal.org handbook for possible reasons this could happen and what you can do to resolve them.
Check your local system logs for additional error messages.

通过查看system logs,发现日志中提示连接超时,日志描述如下:

GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 30000 milliseconds with 423823 out of 448550 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://updates.drupal.org/release-history/drupal/current?site_key=eGB6qvwdHPV6h3CSr1_u4PWQgsLPkeOJ2rQnPRmllvk&version=11.1.6&list=announcements_feed%2Cautomated_cron%2Cbig_pipe%2Cblock%2Cblock_content%2Cbreakpoint%2Cckeditor5%2Ccomment%2Cconfig%2Ccontact%2Ccontextual%2Cdatetime%2Cdblog%2Cdynamic_page_cache%2Ceditor%2Cfield%2Cfield_ui%2Cfile%2Cfilter%2Chelp%2Chistory%2Cimage%2Clink%2Cmenu_link_content%2Cmenu_ui%2Cmysql%2Cnode%2Coptions%2Cpage_cache%2Cpath%2Cpath_alias%2Csearch%2Cshortcut%2Csystem%2Ctaxonomy%2Ctext%2Ctoolbar%2Cupdate%2Cuser%2Cviews%2Cviews_ui in GuzzleHttp\Handler\CurlFactory::createRejection() 

查询资料,发现这是GuzzleHttp的一个问题,而非drupal本身问题,网上提到通过修改vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php文件,解决超时问题,具体修改方法如下:

找到下述代码,去掉两端代码中的_MS后缀。

if (isset($options['timeout'])) {
  $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000;
}
if (isset($options['connect_timeout'])) {
   $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000;
}

修改后的代码如下:

if (isset($options['timeout'])) {
    $conf[CURLOPT_TIMEOUT] = $options['timeout'] * 1000;
}
if (isset($options['connect_timeout'])) {
   $conf[CURLOPT_CONNECTTIMEOUT] = $options['connect_timeout'] * 1000;
}

版权申明:

本博客所有文章除特别声明外均采用BY-NC-SA 4.0许可协议。依据BY-NC-SA 4.0许可协议,转载请附上原文出处链接及本声明。

原文链接: https://www.chahuawu.com/index.php/computer-technology/web-development/drupal-failed-to-fetch-available-update-data-de-jiejue-fangfa.html