1

I just installed wordpress with plugins, everything works find except on a 'contact me' page, where I can see an error like this.

Warning: getimagesize(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/foobar.com/wp-content/themes/foobar/backend/theme-components/cs-header/cs_functions.php on line 751

Warning: getimagesize(http://dev.foobar/wp-content/uploads/2015/11/subheader-image-jobline-1.jpg): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/foobar.com/wp-content/themes/foobar/backend/theme-components/cs-header/cs_functions.php on line 751

cs_functions.php on line 751 is:

    if (is_file($cs_upload_dir . $cs_img_name) || is_file($cs_images_dir . $cs_img_name)) {
        if (ini_get('allow_url_fopen')) {
            if ($header_banner_image <> '') {
                $banner_image_height = getimagesize($header_banner_image);
            }
        }
    } else if (isset($cs_upload_subdir_file) && is_file($cs_upload_dir . $cs_upload_subdir_file)) {
        if (ini_get('allow_url_fopen')) {
           // THIS IS LINE 751
          $banner_image_height = getimagesize($header_banner_image);
        }
    } else {
        $banner_image_height = '';
    }

So, I went to /etc/php.ini and checked allow_url_fopen and it is set to on

allow_url_fopen = On

What is going on? and how do I fix it

2
  • you should basically never call getimagesize on a url. this will slow down your page tremendously.
    – Joel M
    Commented Feb 16, 2020 at 15:24
  • call it on the file path not the url. url starts with http, path starts with ABSPATH constant (in WordPress)
    – Joel M
    Commented Feb 16, 2020 at 15:26

1 Answer 1

0

I'm assuming WP is installed locally, did you make sure to edit your hosts file. Example:

127.0.0.1 dev.foobar
1
  • Yes. I am sure I have that in my hosts file. Otherwise, I wouldn't even have seen the frontpage of my WP site Commented Mar 6, 2017 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.