Dealing with PHP with safe mode on -- can't upload images (5 posts)

  1. zeigen
    Posted 5 years ago #

    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: http://php.net/manual/en/features.safe-mode.php

    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 (http://zeigen.com/cgi/phpinfo.php).

    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?

  2. zeigen
    Posted 5 years ago #

    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?

  3. kmessinger
    Volunteer Moderator
    Posted 5 years ago #

    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.

  4. zeigen
    Posted 5 years ago #

    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.

  5. zeigen
    Posted 5 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic