Unpacking the update... Could not create directory. Wordpress - php

When I instal nextgen-gallery plugins. This error message appears
Downloading update from https://downloads.wordpress.org/plugin/nextgen-gallery.zip…
Unpacking the update…
Could not create directory.
How can I fix this problem ?

This is a permissions issue. Ensure the directory is writable by apache. Plugins are unpacked into the wp-content/plugins directory, so I would first attempt writing to the directory as apache:
sudo -u apache touch /path/to/wp-content/plugins/test.txt
Set permissions accordingly to correct the issue. You can read about permissions here: https://www.pluralsight.com/blog/it-ops/linux-file-permissions
You can read about the correct file permission scheme for Wordpress here: https://wordpress.org/support/article/changing-file-permissions/

#skrilled and #knutole's answer was great but I found that when attempting to fix the issue on the plugins folder, everything was ok and the answer did not work for me.
If anyone else has this issue, try looking at the upgrades folder also. This folder (from what I can see) is used as a folder to store temporary files for when WP upgrades or plugin updates are being ran.
If you simply receive the message stating 'Could not create directory' and there is no path specified, it could actually be talking about the upgrades folder.

Most likely, if you have configured it correctly, the http server associated to your wordpress site belongs to the group www-data. That's how one should configure it correctly.
Try members www-data and ps aux | grep www-data to be sure. In the latter command you should see on the last columns either nginx or apache.
In this case, you just need to set that group to the directory
sudo chgrp -R www-data <your_wordpress_root_dir>/
and then add full group permissions to such directory
sudo chmod -R g+rwx <your_wordpress_root_dir>/
Now it works perfectly :)

for nginx people
if you have php-fpm installed you have to tell it that its user and group is nginx. /etc/php-fpm.d/www.conf . find user which is assigned to apache by default and change it to nginx. also do it for group. then run this command :
sudo service php-fpm restart
also inside of your wordpress directory execute these commands
sudo chown nginx:nginx * -R
sudo usermod -a -G nginx username
change username into what your current username is.
yet you have to apply propper permissions.
run these commands inside your wordpress directory
sudo find . -type f -exec chmod 664 {} +
sudo find . -type d -exec chmod 775 {} +

If you are using vsftpd as your FTP server and have enabled passive connections, you need to add pasv_promiscuous=YES to /etc/vsftpd/vsftpd.conf.

I was having a similar issue. It started with me trying to update a plugin on a migrated WP install. I didn't get it, all my permissions were EXACTLY the same as the old server. In my situation, I started to see that not much was working properly. I couldn't install/delete plugins or themes as well as uploading media would error out. Then I found the fix via some research.
If you are still having this issue, and changing permissions DID NOT fix the problem try this:
Go in to your hosting control panel and find your hosting settings, wherever you can edit your scripting settings. In Plesk (as in my example), this would be under Websites & Domains. Click on your domain name at the bottom. On the next screen, where it says "PHP support (run as..." change the dropdown from "Apache module" over to "FastCGI application". Everything should be fixed up now!

(Re)setting the permissions via ftp didn't make a difference for me either. There is no SSH available, so I had to log in the control panel (directadmin in my case), the File Manager where I could "Reset Owner" to "File ownership reset" the /wp-contents directory.

I'm running Nginx with Wordpress. I deleted the upgrade folder in wp-content and then ran the upgrade from the wordpress GUI again. I noted the linux user for the upgrade folder created was www-data. I then did a {sudo chmod -R www-data:www-data .} Ran the upgrade again from the GUI and it worked.
Probably need to change the permissions on most of the folders so they can't be modified by www-data but I'll figure that out tomorrow.

A permission issue, make sure apache (www-data) has write permissions.

All the above is great, but I think you missed the simplest issue. Your website is using more space than it has allotted, and therefore it is broke. Wordpress makes more files as is in use. If you are on the margin of going over, a simple overnight issue where you did nothing is possible. Go to bed, everything fine. In the morning website is broke.
I own my websites so I go into the reseller part of Hostmonster or Hostgator (I have sites on both hosting platforms) and I reallocate more space and the problem goes away usually. Try that first, or look into it before messing around with permissions. If you changed a permission and the issue came up, could be permissions, otherwise, check this first.

I had the same issue when I tried to install wp plugin(s). However, I managed to solve the problem with the following command:
sudo wp plugin install [plugin name] --allow-root

Related

how to clear cache of laravel app in centos server that uses nginx

enter image description herei'm using centos to host my laravel application,
when i upload the project first time using git, it will be cached, and when i change any file, changes doesn't apply, i tried all artisan commands that clear cache in laravel but didn't fix
the only way is to change the root directory of the application after each single change, is centos caching or nginx or laravel or other software in the server or the browser? even i cleared every thing in public/index.php and put echo 'foo'; and still got old cached data
screenshot of my nginx config file
screenshot of my nginx config file
This is possibly directory permission issue you need to grant storage and bootstrap directory 777 permission level. You need to run the following command on the root folder of your app
chmod -R 777 storage
and
chmod -R 777 bootstrap
Then try to effect your changes.
i tried systemctl restart php-fpm now every thing worked as expected and all changes applied thank you a lot i appreciate your help

Laravel 500 error no logs

First of all, according to stackoverflow, this problem occurs when something is wrong with permissions of bootstrap/cache and storage directories. And I tried literally every advice on that with no luck.
I was happy user of Xubuntu 16.04 at my old laptop, developed one project. Using docker-compose to set up development environment. Yesterday I bought brand new PC, installed Kubuntu 18.04, installed docker and everything I need to work.
Cloned repository, ran composer install, docker-compose up, then php artisan migrate and php artisan storage:link. But when I try to open website in browser, I get 500 error with empty body response.
APP_DEBUG is set to true.
6 hours later I'm here with literally zero results. Tried dozens of solutions found here and on forums (just example).
I even did a little experiment: removed project directory from my old laptop, cloned it from scratch, installed everything required and it worked. Without any permission problem.
And what kills me more: there are no logs inside docker containers, no logs inside laravel directory, just nothing.
Please help! What's wrong? Maybe it's Kubuntu? Maybe it's 18.04? Maybe it's newer docker version?
P.S. Right now bootstrap/cache and storage directories are owned by alex:alex and has 775 permissions. Exactly same as at my laptop.
Add a dd($exception->getMessage()); to the exception handler class right before line 37. Run the request and check the response.
If that doesn't avail anything, verify the request is hitting the webserver by checking access and error logs. Check system logs also using dmesg and similar.
Since you mention Docker, if you're using nginx, be sure your site configuration is not being overwritten when running docker-compose up.
Looks like error is probably either related with storage permissions that should be 777, or with ownershp, or with app's bootstrap, before it even runs your files, when it pulls out configuration setup.
Check the .env configuration, and config files in config directory for any errors.
For storage switch to 777 permissions
chmod -R 777 storage
For configuration issues, try first with
php artisan config:clear
From the console.
If you are on linux server it may be selinux permissions.
Try setting selinux as passive:
in terminal type:
setenforce 0
then see if you see errors. If it works as should you want to turn selinux back on:
setenforce 1
Then give directory writable with selinux command:
chcon -R -t httpd_sys_rw_content_t /path

Plesk Onyx & Nextcloud PHP Errors

I tried to install Nextcloud 13 in Plesk, but if I try to open the link I get a HTTP 500 error.
PHP version: 7.0.27
PHP modules: click here
php_error.log: too long (I can send the pastebin link)
Please tell me if you need more info. I would really appreciate any help.
You might have set the wrong file permission on your Nextcloud installation.
If you created the Nextcloud directory with root permission, you need to change the ownership of the directory to a user or a group, that Plesk has permissions for.
Use these commands to change the ownership (replace myPleskUser with the username you specified during the Plesk installation)
cd /var/www/vhosts/mydomain.tld/
chown -R myPleskUser ./nextcloud
chgrp -R psaserv ./nextcloud

How do I fix this symfony config.php permission error?

I am trying to set up symfony. I am running ubuntu, I have apache2, phpmyadmin and phpstorm installed. I am getting this error under config.php of my project:
MAJOR PROBLEMS Major problems have been detected and must be fixed
before continuing: Change the permissions of either "app/cache/" or
"var/cache/" directory so that the web server can write into it.
Change the permissions of either "app/logs/" or "var/logs/" directory
so that the web server can write into it.
so I went to /var
I tried a few things:
sudo thunar and then changed all the permissions to writeable. This didn't work and the permissions changed right after.
I went on this site, it says to use certain commands to fix permissions: sudo chmod 754 /var/cache and sudo chmod 754 /var/log and sudo chmod -R 775 /var/cache and sudo chmod -R 775 /var/log
This also did not work
I should also note that I have cleared my cache and restarted apache2.
Glad you figure it out by your self.
In any case you can read more about it here: Setting up Permissions / Symfony2
Let me know. Ciao!
I figured it out. The cache and log are within the app themselves. This did not make much sense to me initially considering that the permissions of the folder they are in (the root, the www folder) had already had all their permissions set appropriately. All I did was set chmod -R 755 on those folders IN my app.

phpMyAdmin "Cannot load or save configuration"

I have been trying to setup phpMyAdmin on a macbook pro running yosemite 10.10.2. I have created a config folder in phpmyadmin and have given it the permissions required:
chmod o+wr ~/Sites/phpmyadmin/config
However, when I then go onto "localhost/phpmyadmin/setup" I get an error:
Cannot load or save configuration
Please create web server writable folder config in phpMyAdmin top level
directory as described in documentation. Otherwise you will be only able to
download or display it.
(I have tried attaching an image, but can't due to my reputation points)
I have tried resetting the permissions, tried deleting and recreating the folder. Tried redownloading the phpmyadmin zip but nothing seems to work.
Could anyone kindly advise me what I am doing wrong and how I am best placed to solve this issue?
I have had similar issue on my Ubuntu 16.04. I made a research and in the end I found a resolution of the issue. Maybe my case solution will help somebody else.
Background: For security reasons I have non privileged user and group apache:apache (sudo groupadd apache | useradd -g apache apache). They are preset by directives (User apache; Group apache) in /etc/apache2/apache2.conf. This user apache:apache owns Apache2 main directory (sudo chown -R apache:apache /etc/apache2) and some other files, for example: sudo chown -R apache:apache/etc/phpmyadmin/htpasswd.setup
In this manual: http://docs.phpmyadmin.net/en/latest/setup.html - I found that...
Debian and Ubuntu have changed way how setup is enabled and disabled,
in a way that single command has to be executed for either of these.
To allow editing configuration invoke:
/usr/sbin/pma-configure
To block editing configuration invoke:
/usr/sbin/pma-secure
Note! In the content of the two files listed above we talk about /var/lib/phpmyadmin/config.inc.php instead of /etc/phpmyadmin/config/config.inc.php. It was the key.
In my case I was modified the content of these scripts (see below) and now I can use localhost/phpmyadmin/setup properly.
/usr/sbin/pma-configure:
#!/bin/sh
echo "Unsecuring phpMyAdmin installation..."
echo "Setup script can now write to the configuration file."
echo
echo "Do not forget to run /usr/sbin/pma-secure after configuring,"
echo "otherwise your installation might be at risk of attack."
sudo sudo chown -R apache:apache /var/lib/phpmyadmin/config.inc.php
chmod 0660 /var/lib/phpmyadmin/config.inc.php
/usr/sbin/pma-secure:
#!/bin/sh
echo "Securing phpMyAdmin installation..."
echo "Setup script won't be able to write configuration."
sudo sudo chown -R root:root /var/lib/phpmyadmin/config.inc.php
chmod 0640 /var/lib/phpmyadmin/config.inc.php
I was able to use phpMyAdmin in my ~/Sites directory and remove the warning by giving the config folder writable access as such:
chmod 756 ~/Sites/phpmyadmin/config
Does it work if you try setting up PHPMyAdmin in system root versus user root? On OSX that server web root should be under /Library/WebServer/Documents?
I used this guide when I set mine up, and it works fine, although I did not use Sites as my root.
http://www.dingendoen.com/osx-installs-configuration-examples/install-apache-mysql-php-on-osx-yosemite/
For local development, changing permissions worked for an OSX Sierra install:
sudo chown -R _www:_www ~/Sites/phpmyadmin

Categories