I can't seem to figure out why I get the following when I try to upload anything in wordpress... for both media uploads and wordpress import xml:
"Sorry, there has been an error. File is empty. Please upload something more substantial. This error could also be >caused by uploads being disabled in your php.ini or by post_max_size being >defined as smaller than upload_max_filesize in php.ini."
Seems to be very little on how to troubleshoot this is online in way of nginx/php-fpm... most of which is about php.ini max configs or chmod, which... in my setup
post_max_size is large enough as well as
/etc/php5/fpm/php.ini (as well as timeouts)... and chmod/chown seems correct for using separate php pools. Maybe someone can make heads or tails of this?
Here's my setup:
- Cloudflare (is off) to Floating IP
- Digitalocean Floating IP to droplet
- Droplet is Ubuntu 14.04 with nginx using php-fpm with pools created for each wordpress ms installation (x4 atm)
- SSL with Let's encrypt used for each wpms installation
- Chmod 755 for all wpms directories in site roots
- Chmod 644 for all wpms files in each site roots
- Chmod 660 for wp-config.php
- Chown each php5-fpm pool user on all files/directories for within their own site root
chown -R example1:example1 /home/example1/*
- Wordpress is one directory below their nginx conf roots. eg
- php.ini has uploads enabled with directory defined (/home/tmp/)
The users are NOT in www-data group nor sudo group, I read doing so is a security risk but even so I temporarily tried adding them to www-data group to see if the wordpress uploading would work... it didn't. I've also tried chown example1:www-data ownership as well, didn't work. I've also tried chmod 777 for uploads folder, didn't work.
Error logs have the following: in wpms-error.log (this also doesn't make sense to me)
2016/05/20 01:12:00 [crit] 1584#0: *1251 open() "/home/example1/example1.com-access.log" failed (13: Permission denied) while logging request, client: [my IP address], server: example1.com, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-example1.sock", host: "example1.com", referrer: "https://example1.com/wp-admin/admin.php?import=wordpress&step=1&_wpnonce=dad4d82487"
in these site's nginx conf files I have:
access logs are enabled in nginx.conf (even though not recommended) but access logs for each site is not being written to their site roots.
so... after trying everything I've read online... I've yet to find out even what the underlying issue is... because file permissions alone doesn't seem to be it? .. is it???
The following (after changing usernames to example1 etc) is
ps aux | grep php results:
root 993 0.0 0.2 266688 11396 ? Ss May18 0:10 php-fpm: master process (/etc/php5/fpm/php-fpm.conf) example1 1003 0.0 1.1 302568 45856 ? S May18 0:32 php-fpm: pool example1 example1 1004 0.0 1.1 304620 47808 ? S May18 0:31 php-fpm: pool example1 example2 1005 0.0 1.1 304360 47648 ? S May18 0:30 php-fpm: pool example2 example2 1007 0.0 1.1 302308 45956 ? S May18 0:30 php-fpm: pool example2 example3 1008 0.0 0.1 268640 7704 ? S May18 0:00 php-fpm: pool example3 example3 1009 0.0 0.1 268640 7744 ? S May18 0:00 php-fpm: pool example3 www-data 1010 0.0 0.1 266680 7560 ? S May18 0:00 php-fpm: pool www www-data 1011 0.0 0.1 266680 7564 ? S May18 0:00 php-fpm: pool www example4 1013 0.0 0.9 296016 39704 ? S May18 1:24 php-fpm: pool example4 example4 1014 0.0 1.3 310952 55024 ? S May18 1:23 php-fpm: pool example4 example5 1015 0.0 1.0 297352 40940 ? S May18 0:32 php-fpm: pool example5 example5 1016 0.0 1.1 305104 48232 ? R May18 0:32 php-fpm: pool example5 example4 1105 0.0 0.9 296016 39596 ? S May18 1:20 php-fpm: pool example4 example1 1313 0.0 0.9 296284 39884 ? S May18 0:31 php-fpm: pool example1 example2 1317 0.0 1.1 304364 47628 ? S May18 0:29 php-fpm: pool example2 example5 1332 0.0 0.9 296880 39056 ? S May18 0:29 php-fpm: pool example5 example3 3727 0.0 0.0 11744 932 pts/1 S+ 18:42 0:00 grep --color=auto php
example3 above is not a wpms site, it's just an empty root atm and that user is also in the sudo group and has it's own ssh login. I don't know if that's relevant.