I have not been able to upload images to my Wordpress site using the media tool from the Wordpress admin panel. I'm getting the following error.
“logo512x512.png” has failed to upload. Unable to create directory wp-content/uploads/2020/01. Is its parent directory writable by the server?
I have gone through a ton of solutions to this problem but not one has worked for me. I am in the windows 2016 server machine. with a MySQL database. I do not have PhP admin not have a Cpanel.
My ftp is working. I am able to get themes and plugins without any problem. Any ideas?
I had a similar issue with a Google Cloud Engine Instance, with no cPanel, no phpMyAdmin and FTP, on Ubuntu and Apache. And I solved this way:
1. Define upload folders on wp-config.php
Open wp-config.php with nano or vim and add the following code
define( 'UPLOADS', 'wp-content/uploads' );
before this line:
require_once(ABSPATH . 'wp-settings.php');
and save it.
2. Change owner
Change to wp-content directory. In my case (use your own path):
cd /var/www/html/wp-content
Next, change the owner to www-data
chown -R www-data:www-data plugins
Why www-data? In my case, is the name of the apache service account running on my server. You can check the name with:
ps aux | egrep '(apache|httpd)'
that comand returns some like this:
www-data 5441 0.0 5.8 566184 34896 ? S 06:34 0:00 /usr/sbin/apache2 -k start
www-data 7753 0.0 5.9 566248 35512 ? S 09:00 0:00 /usr/sbin/apache2 -k start
www-data 9840 0.0 5.7 566160 34320 ? S 11:21 0:00 /usr/sbin/apache2 -k start
www-data 21068 0.0 6.2 564032 37192 ? S 18:22 0:00 /usr/sbin/apache2 -k start
www-data 21069 0.0 6.0 563692 35636 ? S 18:22 0:00 /usr/sbin/apache2 -k start
root 21455 0.0 0.1 13208 1036 pts/1 S+ 18:44 0:00 grep -E --color=auto (apache|httpd)
root 31982 0.0 1.1 485904 6872 ? Ss Jan03 0:18 /usr/sbin/apache2 -k start
as you see, root and www-data. Maybe with windows server the account will be different (tasklist? pslist?), i don't know how to get it (I never used windows server, sorry). I Hope www-data works for you.
Finally, make sure uploads folder had the right permissions
chmod 755 -R uploads
3. Grant to that user rights to use Wordpress
To html or public_html folder (in my case /var/www/html, change it for your own path)
chown -R www-data /var/www/html
And voilà. I hope this little guide was useful, or at least, give you ideas to solve it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With