• Has anyone else gotten this PHP warning when loading local avatars into a WP template?

    Warning: fopen(http://path.to/avatar_1377020614-140×140.jpg): failed to open stream: HTTP wrapper does not support writeable connections in /server/www/wp-includes/class-wp-image-editor.php on line 342

    I haven’t been able to consistently reproduce this issue. But it has only occurred on WP 3.6 for me. When the PHP warning occurs, it’s preceded by a string of crazy characters that I suspect is the image data attempting to be printed out. After a refresh, the page is fine and the avatar image loads as it should.

    Here’s the function I’m using to load the avatar when this error occurs on the page:

    <?php echo get_avatar(get_the_author_meta('ID'), 100); ?>

    http://wordpress.org/plugins/simple-local-avatars/

Viewing 5 replies - 1 through 5 (of 5 total)
  • It’s hard for me to explain the “ok after refresh” for that I can only guess, but I think you’ll find that the user/group ownership is different for those particular files/folders that experience the issue.

    You should check the value of the file indicated in the db, then notice it will probably be set to “root:root” as owner:group, or in any case set to something that your php doesn’t have immediate permission to work with.

    If it’s ok after refresh, I’m wondering (since I don’t know how the script function get_avatar() is set up, if perhaps there is some cacheing going on, after which the file does have permissions OR if the issue isn’t actually that the image is being made on the fly at size 100, doesn’t technically exist until the function runs once, then gets handled as OK with proper permissions (ownership, technically, not really permissions) afterward.

    In any case the fishbowl this problem swims in is permissions based.

    I’m having exact same issue. Have you found anything that works yet? Maybe we can ask Jake to provide some insight, though he’s likely very busy with 10up.

    My particular problem related to FTP ownership issues. I had several items with the root:root owners whereas most items were www-data:www-data.

    (Running Debian 7, Nginx 1.2, MySQL 5.5, Php 5.4)

    I had to reinstate remote root access (I had config’d it off before) then
    chown -R www-data:www-data /var/www

    that solved my immediate issue- however my issue continued to be an ADMINISTRATIVE one. FTP was setting ownership that wasn’t working, and the problems persisted with new files on upload.

    My instinct was to adopt all FTP users with Admin into the www-data group, and then change dir permissions to allow group write… but… since I am actually THE admin I just began using www-data as the FTP user! Basically I put off the problem.

    I am still not clear in your case(s) if the issue stems from using files which are not hosted on the root domain… for example using http://www.offsite.com/avatarImage1.jpg on http://www.mysite.com/my-new-post/

    If that is the case my “solution” will need extension to serve the actual issue. I’m going to solve both problems within a week or so- 1: allowing other FTP users besides www-data to upload files used (normally) by WP. And allowing offsite images to load corrrectly. I’m super busy with a launch right now using this setup so it’s part of the to-do list, just not A-1 priority today.

    PS- to help others please at least list your server setup (even if it’s shared hosting understanding what servers are generating the issue would be helpful context) and your url if possible.

    Include this page

    require_once(ABSPATH . ‘wp-admin/includes/image.php’);
    before where the function calls. This resolve error in my case..

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP warning: HTTP wrapper does not support writeable connections’ is closed to new replies.