用drupal做了一个网站,在本机开发和测试都没出现这个警告,发布到万网的阿里云服务器上后,出现了如题的错误。google+drupal官网,说是因为安全原因引起的,服务器提供商没有开启一个叫要stream_socket_client()的函数,去万网的控制面板查看php函数设置,没有这个函数,倒是看到一个fsockopen的函数默认被禁用了。
试着打开这个函数,然后刷新网站,警告消失了。
官网上看到的一段话,记一下
Notice:
Undefined variable: errno in drupal_http_request() (line 829 of /foobar.com/includes/common.inc).
Notice: Undefined variable: errstr in drupal_http_request() (line 830 of /foobar.com/includes/common.inc).
In my case (as it turns out), my hosting provider had disabled a whole basket of php functions (41 in total) for security reasons. One of the disabled functions was stream_socket_client().
My host provider was kind enough to enable this function (after I told them it was now part of Drupal 7 core) but they offered the opinion that this was a security compromise.