WordPress + suExec = can not upload ?

If you find that you can not upload pictures anymore to WordPress, and the only things that have changed is your webhoster — then your webhoster may have suExec setup on their server.

suExec is a module for Apache webserver that makes it more secure.
Basically, it will execute scripts with its owner’s permission – not Apache’s.

In this case however it can cause problems when uploading, I have posted the details on WordPress forum :

With suExec you’ll still have problems uploading, usually you’ll get the follwoing error message :

The uploaded file could not be moved to /home/myusername/myblog.com/wp-content/uploads/2008/06.

Reason being because WP created that 2008/06 dir as apache’s user (www-data / httpd / etc), but suExec require that dir to be owned by myusername – otherwise the upload will fail.

Changing the directory’s ownership to myusername fix the problem – but on the next month (when WP created the new directory for that month) you’ll encounter this problem again.

A workaround is to setup a cronjob that will fix the permission / ownership of the uploads directory (on WPMU : blogs.dir) automatically on the beginning of every month.

Ideally, this shouldn’t happen, but I haven’t got an idea at all.

Hope it helps someone out there.

20 thoughts on “WordPress + suExec = can not upload ?

  1. jelas pasti akan error mas, kalau pake suexec, folder itu harus dibuat sebagai milik user biasa, bukan httpd,

    solusi singkat, di chown -R user.user namafolder
    pake cronjob script bisa juga, tapi ngga akan berhasil 100%

    kalau dari saya, coba buat user baru, yang levelnya rendah, terus jalanin si situs dari dalam direktori mereka, misal /home/username/public_html dan perbaiki httpd.conf agar jalan dengan suexec, chmod si folder yang mau di writablenya itu ke 777, terus pasang suhosin, it works, tp ga tau kalo di tempatnya mas, lum pernah masuk

  2. Well yes, this is one method which can solve the upload problem. If it is the problem with suexec. The prob can be so many things. as Free ebook mentioned the owner and chmod folder needs to be checked. Anyway, good tip. Appreciate the work.

  3. Interesting article. Nowadays new bloggers have many resources to solve their problems. I wish I had such help when I started blogging. this article is one useful resource for newbies. Nice work. Keep it up.

  4. Ohh man. finally. Thanks a bunch for the solution. I’ve been having this problem for weeks now. and this sorted it out. Thanks again. Your a life saver

  5. Bingo, worked like a charm, thanks! One of my sites was having this issue for 2 months. I never had thought it was my web host that caused the issue.

  6. Process running, the php/server (chmod 777) works properly on some server installations. However, any directory whose permissions have been set to ‘777’ present a (real) security hole: a malicious visitor could upload a script to that directory and hack your site… Thank you.

  7. Nowadays new bloggers have many resources to solve their problems. I wish I had such help when I started blogging.

  8. The prob can be so many things. as Free ebook mentioned the owner and chmod folder needs to be checked. Anyway, good tip. Appreciate the work.

  9. I wish I had such help when I started blogging. this article is one useful resource for newbies. Nice work. Keep it up.

  10. The prob can be so many things. as Free ebook mentioned the owner and chmod folder needs to be checked.

  11. The prob can be so many things. as Free ebook mentioned the owner and chmod folder needs to be checked. Anyway, good tip. Appreciate the work.

  12. If it is the problem with suexec. The prob can be so many things. as Free ebook mentioned the owner and chmod folder needs to be checked. Anyway, good tip. Appreciate the work.

  13. whose permissions have been set to ‘777′ present a (real) security hole: a malicious visitor could upload a script to that directory and hack your site… Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *