ISPConfig - Wordpress Media Upload error

Discussion in 'Tips/Tricks/Mods' started by Yatin Chawla, Nov 8, 2017.

  1. Yatin Chawla

    Yatin Chawla New Member

    I am facing issue with Wordpress Sites which I have setup through ISPConfig (Version: 3.1) running on Red Hat Linux Server with Apache

    Whenever a new image is being uploaded from the Wordpress Admin panel, I get the error as
    The uploaded file could not be moved to wp-content/uploads/xxxx/xx


    This happens when there is change of directory like its November and I am uploading first image for the month, so by default directory is created as wp-content/uploads/2017/11


    The primary diagnose which I am able to see is that the directory being created is owned by root user by default while it should have been web11:client2 (I have few sites in ISPConfig, each site has its own user owner like web10,web11,etc and group as client2 which is configured in ISPConfig)

    I have tried to change the ownership of parent wp-content directory by using chown -R web11:client2 /wp-content/
    this works for the current folders but whenever a new directory gets created in uploads, that is owned by root only and I have to then manually run this command on getting the error each month.


    Looking for a permanent fix to the issue.
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    what php mode are you using? make sure you have suexec enabled, and use php-fpm or fastcgi mode for starters. maybe create a page running phpinfo() and see what effective user your php is running as.
  3. Yatin Chawla

    Yatin Chawla New Member

    I am using Fast-CGI in PHP & suexec is already enabled.

    Below is the screenshot.

  4. adamjedgar

    adamjedgar Member

    so this new folder is being created by Wordpress yes? (which is how it should be)

    Could it be that Wordpress is running as "root" user? This would be obviously wrong and needs changing. I am imagining that perhaps you installed wordpress as "root"?

    Wordpress should be running as the same user as the previous month folders (as seen in your example web11:client2).
  5. Yatin Chawla

    Yatin Chawla New Member

    Wordpress was installed from within the ISPConfig from packages option, But sure I'll check about changing that If i can now, as installation wasn't having such option.

  6. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Wordpress is just a php app, so it runs as whatever user php is setup to use, which appears to be root. You can confirm that by setting up a page to run phpinfo() (eg. under ENVIRONMENT it lists 'USER' which should be something like web123, not root, or check $_SERVER['USER'], which should be the same).

    Check that you have mod_suexec enabled in your apache config, and you might also verify the .vhost file created for the site to ensure it has
                    <IfModule mod_suexec.c>
                            SuexecUserGroup web11 client2

Share This Page