I’m using WordPress on centos 6.
I try to install a plugin. But I got this error:
Installing Plugin: bbPress 2.5.9
Downloading install package from https://downloads.wordpress.org/plugin/bbpress.2.5.9.zipâ¦Unpacking the packageâ¦
Could not create directory.
How can I resolve this?
P/S: I run this command:
sudo -u root touch /var/www/html/wordpress/wp-content/plugins/test.txt
and it works. But I still get that error.
You only need to change the access permissions for your WordPress Directory:
You can fix this by using the following commands. You should first be in the root folder of WordPress.
The user that is running your web server does not have permissions to write to the directory that WordPress is intending to create the plugin directory in. You should chown the directory in question to the user that is running WordPress. It is most likely not root.
In short, this is a permissions issue. Your touch command is working because you’re using it as root, and root has global permissions to write wherever it wants.
A quick solution would be to change the permissions of the following:
/var/www/html/wordpress/wp-content
/var/www/html/wordpress/wp-content/plugins
Change it to
775
.After installation, don’t forget to change it back to the default permissions.. 😀
I had to give ownership of
/plugins
and/upgrade
to the server, nothing else.Running Apache server on Ubuntu 18.04. Maybe more dirs will need to be changed later. Anyways, I plan to restore permissions once I finish editing, as suggested in this anwser.
If you have installed wordpress using apt, the config files are split in multiple directories. In that case you need to run:
The
-h
switch changes the permissions for symlinks as well, otherwise they are not removable by userwww-data
To solve permission issue on plugins and themes on localhost or production quickly, you just run this
if take care permission on production, you can run
CentOS7 or Ubuntu 16
1.
WordPress uses
ftp
to install themes and plugins.So the
ftpd
should have been configured to create-directoryand if it is no then should be yes
lastly
2.
Maybe there is an ownership issue with the parent directories.
Find the Web Server user name and group name if it is Apache Web Server
it will print
on Ubuntu it is
then
3.
Sometimes it is because of directories permissions.
So try
in some cases
755
does not work. (It should & I do not no why) so try4.
Maybe it is because of php safe mode.
So turn it off in the root of your domain
then add
NOTE:
For not entering FTP username and password each time installing a theme we can configure WordPress to use it directly by adding
to the wp-config.php file.
If you are mac user , using XAMP
Go to the htdocs folder and open the terminal on the folder , as shown in the screenshot
Then Type the following command on the Terminal
E.g sudo chmod -R 777 wordpress/
You need to change the permission of the directory
At first change the user HTML folder (replace yourcomputerusername)
sudo chown yourcomputerusername:yourcomputerusername /var/www/html
Next change the permission for the user
cd /var/www/html
sudo chmod -R goa=rwx wordpress
or
sudo chmod -R 777 wordpress/wp-content
If anyone using shared hosting and get same problem it may be disk space issue. In that case contact with your hosting support and ask them to increase disk space of your acocunt.
I was on XAMPP for linux localhost and this worked for me:
sudo chown -R my-linux-username wp-content
What I end up doing is every time I create a WordPress project. in /www/html
I run below command
hope this will help someone.
For me the problem was FTP server that WP is using to upload update. It had writting disabled in configuration, so just enabling it fixed the problem.
Shame on WordPress for providing such misleading error message.
You could try
None of the above work for me except this one.
sudo chown daemon:daemon /opt/bitnami/apache/htdocs/
Don’t forget to change
/opt/bitnami/apache/htdocs/
to your directoryWebserver user must have write access to directories to perform such operations, so you can try to change owner of files to webserver user (
apache
in this example, but can be differ from yours)If you are using some app that wraps http, you have to set these user in the command.
By example, if you are using lampp, the users that init httpd is “daemon” and the command that works will be:
You can search in your httpd.conf file
wordpressProject is the project name.
Thanks. It will work.
Absolutely it must be work!
chown -Rf www-data:www-data /var/www/html