Support » Fixing WordPress » Dealing with PHP with safe mode on — can't upload images

  • Recently my host switched on safe mode for PHP due to an exploit. They say they can’t go back to having safe mode off.

    For reference:

    Unfortunately for WordPress, that means I can no longer use the automatic updates and can no longer upload images. Even with chmod 777, and no matter which way I’ve configured the Settings | Media section as far as upload directories are set, I get the dreaded error message:

    “foo.jpg” has failed to upload due to an error
    The uploaded file could not be moved to /home/users/[…]/public_html/blog/wp-content/uploads.

    If I try to set “Organize my uploads into month- and year-based folders” it does manage to create the 2011 and 04 directories, but I still get:
    The uploaded file could not be moved to /home/users/[…]/public_html/blog/wp-content/uploads/2011/04.

    I’ve used phpinfo to verify that php runs as www on the host’s server (

    I can’t run chown directly myself, but I’ve experimented with having support chown all of the PHP scripts to www:www as well as the uploads directory owned by www:www, but I still get the same error messages.

    I suspect that WordPress is using some other process to physically upload the file, perhaps an ftp service?

    My ISP is running FreeBSD 6.2-RELEASE-p8 (GENERIC).

    Has anyone solved this problem?

Viewing 4 replies - 1 through 4 (of 4 total)
  • So I suppose the best answer is to tell the ISP to update to the latest version of PHP which doesn’t have safe mode?

    Moderator kmessinger


    Have you checked dashboard, settings, media, store uploads in this folder? If you have this there, wp-content/uploads, make sure there is not a slash in front of wp-content.

    Thanks, kmessinger, done all that and experimented a trillion different ways. The problem occurred precisely when my ISP switched on safe mode, no other changes were made.

    The weird thing is that I can upload images via the WordPress iPhone application.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dealing with PHP with safe mode on — can't upload images’ is closed to new replies.