Cannot update plugin for WordPress on localhost on Mac - wordpress

I'm running WordPress 5.8.1 on localhost, on my Mac. I am unable to update plugins. I get this error:
Update failed: Could not create directory.
I've tried changing the permission on the wp-content folder as suggested here like this:
sudo chmod -R 755 wp-content
but it didn't work. I still get the error message.
I also tried this
sudo chown -R _www wp-dir
sudo chmod -R g+w wp-dir
still no luck.

Ok, Managed to find the issue. Apache uses a different username so this command was ok:
sudo chown -R _www wp-dir
But my username wasn't _www (hence my error)
you can find the apache username in the etc/httpd.conf file

Related

Nginx permissions with wordpress

I am trying to set up wordpress on digitalocean with nginx. I am running into permissions issues though. When I upload a file or try to install a plugin I get the cannot create in directory warning. So I came across the post Here that says I need to give nginx access to the folder. So I executed the following:
sudo chown -R www-data:www-data /path/to/folder
sudo chmod -R 755 /path/to/folder
This works except now I cannot add and delete files with filezilla. Obviously because the permissions to the folder are no longer with the me the user they are now with www-data.
So my question is what is the correct way to configure nginx to work with wordpress and still allow me to upload and delete files with ftp.
When using digital ocean droplets you will probably be using sftp access to your server.
Try the following commands in your terminal when logged in.
Add your currently logged in user to the www-data group:
sudo usermod -aG www-data $USER
Then change your vhost directory and all files and subdirectories to be owned by www-data group:
sudo chown -R www-data:www-data /var/www
Set the proper permissions so you can upload files via sftp, manage files via command-line, and upload plugins and media directly in WordPress:
sudo chmod -R 774 /var/www
Hope this helps
Saskia

WordPress File Access Permission

I am trying to upload an image to set a background image for my theme, but I get this error:
Unable to create directory wp-content/uploads/2018/05. Is its parent directory writable by the server?”
I tried to change the access permissions with the help of these blogs:
https://www.digitalocean.com/community/questions/setting-permissions-for-wordpress
https://gist.github.com/Adirael/3383404
But nothing has helped me, and now I also get a 500 error page.
I'm stuck here, can anybody help?
-----------Comment-----------
Output Image for ps -ef| grep httpd
I executed this command
find . type f -exec chmod 644 {} \;
and the 500 error page is not being displayed now. I am able to view my web page. But I am still unable to upload a background image. (same error appears "Unable to create directory wp-content/uploads/2018/05. Is its parent directory writable by the server?")
The following command will fix your issue
sudo chmod -R 777 wp-contents/uploads/
If you're using Bitnami Lamp then run the following commands in your SSH terminal:
sudo chown -R bitnami:daemon /opt/bitnami/apache/htdocs
sudo chmod -R g+w /opt/bitnami/apache/htdocs
sudo chmod 440 /opt/bitnami/apache/htdocs/wp-config.php
sudo chmod 440 /opt/bitnami/apache/htdocs/.htaccess
and if you're using Bitnami WordPress then run the following commands in your SSH terminal:
sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs
sudo chmod -R g+w /opt/bitnami/apps/wordpress/htdocs
sudo chmod 440 /opt/bitnami/apps/wordpress/htdocs/wp-config.php
sudo chmod 440 /opt/bitnami/apps/wordpress/htdocs/.htaccess
The recommended permissions are:
Directories: 775
Files: 640
wp-config.php and.htacess: 440
Thanks
Maybe is already solved, but can help other users with similar issues.
I made a Shell Script on Debian10 to solve permissions issues.
After running it, I make the folder accesible on the Apache2.conf too (WordPress can't Upgrade or Upload Media if not)
What it does:
Set new Owner on all Files and (Sub)Directories ( user:group )
Set Permissions: 755 to Directories and 644 to Files
wp-config.php : Preventing world access for "wp-config.php", leaving it accesible to WordPress (660)
Allow WordPress to manage the "wp-content" (Directories to 755 & Files to 664)
Privatize "wp-content" (Set 755)
Link:
https://github.com/ieselisra/wordpress_fix_permissions_debian10/

correct rights linux webserver

I have installed a LAMP server (Ubuntu) on a VPS and everything seems to be running fine. After uploading and installing WordPress I ran into a couple of rights issues (not being able to upload, not being able to create/change the .htaccess file from within WordPress, the usual) so I chmod the directory so the www-data user is owner:
sudo chown -R www-data:www-data /var/www/domain.com/public_html/
Now all of the above works fine, but...
When I upload a file or directory the owner/group is set to the user I'm using to "FTP" with. This results in WordPress not being able to update the files (e.g. a plugin). The user I'm using for FTP transfer is part of the www-data group.
What should/can I do to prevent this and thus automagically add the www-data owner/group to uploaded files? And is this the way to go?
Think I found it: https://help.ubuntu.com/lts/serverguide/httpd.html
Sharing Write Permission
sudo chgrp -R www-data /var/www/domain.com
sudo find /var/www/domain.com -type d -exec chmod g=rwxs "{}" \;
sudo find /var/www/domain.com -type f -exec chmod g=rw "{}" \;

Could not create directory - wordpress plugin installation failure on mac

Good day folks
I tried to install wordpress plugins in Mac in localhost but i am getting this error:
Could not create directory. /Applications/XAMPP/xamppfiles/htdocs/kew/wp-content/plugins/revslider/
Plugin install failed.
I changed the permissions of the installation folder to Read & Write but the error is not resolved.
Kindly assist me.
Regards
You need to set permission on plugin folder/directory.
Via terminal write this
sudo chmod -R 777 wp-content
Try this in the terminal:
sudo chmod 0775 /Library/WebServer/Documents
sudo dseditgroup -o edit -a username -t user _www
rahulmahato$ sudo dseditgroup -o edit -a rahulmahato -t user _www
Note: Replace username with yours :)

Cannot Install or update WordPress plugin & WordPress core

When i try to update any plugin it will show blank page on the right. No errors displayed.
Uninstall is working perfectly.
Cannot install new plugin & cannot update WordPress Core
NO ERRORS DISPLAYED, only white page on right (you can see side menu of dashboard)
Hosting my Files in VPS - Centos 6 - Apache 2.4.6
Recently i updated PHP 5.3.26 to PHP 5.4.17
I tried Changing Owner Permission to Apache. (i was unable to login - then changes back to my username)
I tried chmod 777 no use.
I tried adding in wp-config.php - define('FS_METHOD', 'direct'); & chmod 777 to wp-content directory.
Please help.
NEVER use 777 permission! Wordpress only need 755 for folders, 644 for files, and 666 for themes and plugins directory recursively. And you might want to give 600 to wp-config.php.
I had this problem, I use CentOS 7 though, this is how I solved the issues.
Make sure all owned by Apache.
sudo chown -R apache:apache /var/www/html/sitedir
Give proper permissions
sudo find /var/www/html/sitedir -type d -exec chmod 755 {} +
that would give 755 permission to all folder inside sitedir
sudo find /var/www/html/sitedir -type f -exec chmod 644 {} +
that would give 644 to all files
sudo find /var/www/html/sitedir/wp-content/themes -type f -exec chmod 666 {} +
sudo find /var/www/html/sitedir/wp-content/plugins -type f -exec chmod 666 {} +
those two commands above make 666 permission to all files inside themes and plugins folder
If you use selinux
set this first
sudo chcon -R system_u:object_r:httpd_sys_content_t:s0 /var/www/html/sitedir
then this
sudo chcon -R system_u:object_r:httpd_sys_rw_content_t:s0 /var/www/html/sitedir/wp-content
Restart php-fpm service if you had one.
UPDATE:
If you don't get through until this point. You might also need to set a local policy module for selinux.
sudo grep php-fpm /var/log/audit/audit.log | audit2allow -M mypol
sudo semodule -i mypol.pp
Then restart php-fpm.
As I cover here more detail on my blog :)

Resources