Permissions issues when uploading plugins from Wordpress locally - php

I'm trying to work on Wordpress locally via localhost with Xampp. The issue comes when I try to download plugins.
It says:
Installation failed: Could not create directory.
I'm guessing it's permissions issue. I tried many things like
chmod 777 /opt/lampp/htdocs/wordpress/wp-content/plugins
chown -R www-data:www-data /opt/lampp/htdocs/wordpress/wp-content/plugins
I'm quite new to Ubuntu so I tried a bunch of things similar to the above to try and find the directory that needed permissions
**Solution
It worked for me -->
find /opt/lampp/htdocs/wordpress -type d -exec chmod 777 {} \;

Related

Cannot update Wordpress theme and plugins (file permission issues) in linux server

The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.
When trying to update plugins from the admin interface. I’ve set the user to www-data for both directories and files … but nothing works.
What do I have to do to simply being able to use Wordpress as it is intended?
This issue is usually caused by incorrect file permissions or ownerships on your server (rather than being a problem with the plugin itself). Basically, WordPress isn’t able to properly access its own plugins folder, and as a result, can’t put the updated plugins files in there.
Permissions
Permissions can be set to 644 for files and 755 for folders. To do so, you can run two quick find commands.
To make all folders in your website path with 755 permissions run the following command
find /path/to/your_website -type d -exec chmod 755 {} \;
To make all files in your website root directory with 644 permissions, you can run
find /path/to/your_website -type f -exec chmod 644 {} \;
Please make sure to change /path/to/your_website with your real path.
Ownership
Ownership means which user and group are controlling the files. Usually, that’s www-data. So what you’ll need to do si
sudo chown -R www-data:www-data /path/to/your_website
Please make sure to change /path/to/your_website with your real path.
Once you do it, that’s it, you are good to go.

WordPress Plugin update asking for FTP

I moved a WordPress site to our VPS. In admin I am asked to update plugins, if I do that I am prompted for FTP info. As we don't run FTP on the server this is not possible.
I then changed the the permissions of all of the files to apache:apache using:
chown -R apache:apache *
This fixed the issue and WordPress can now update the files, however, now I cannot edit the files using filezilla. I also tried changing ownership to:
chown -R myuser:apache *
So that I can edit the files but give apache group access. Now I can edit the files with filezilla but no longer update items in WordPress.
So, what is the correct way to go about this giving me write access on file level but still giving WordPress access to update the files?
Seems file permission issue.
cd wordpress
sudo find . -type d -exec chmod 0755 {} \;
sudo find . -type f -exec chmod 0644 {} \;
and following
define( 'FS_METHOD', 'direct' );
in wp-config.php
or
sudo chown -R www-data:www-data wordpress
From WHMPanel, Software, Multi PHP Manager, enable Enable PHP-FPM to fix file permissions issues.
This prevents the popup appearing asking for FTP credentials.

PHP pages getting 404 in public_html

I have a couple of PHP-based projects (that are working fine locally), but I'm looking to host on the same server as my Wordpress site/portfolio.
I have put those folders in public_html folder in my file structure but they are generating a 404 error when I try to load them.
HTML based pages work fine, for PHP it's not. Does anyone have any ideas?
I'm sure I'm missing something fairly obvious but am at a loss at the moment...
You need to change the permission of files. Either change it via command line,
find foldername -type d -exec chmod 755 {} \;
find foldername -type f -exec chmod 644 {} \;
Or change it via cPanel,
Change permission for files to 644 and folders to 755

How to change permissions of Wordpress and/or apache on macOS securely?

I have encountered a problem when trying to add an image to WordPress:
"Unable to create directory wp-content/uploads/2017/05. Is its parent directory writable by the server?".
Thing is that I installed WordPress locally, without MAMP. Root for Apache is /Library/WebServer, port is 80.
Already tried adding define( 'UPLOADS', 'wp-content/uploads' ); to wp-config.php, but it didn't work. According to this, I assume that problems are with permissions of WordPress to /Library/WebServer.
Anyone knows how to change this permissions securely?
Use command line tools.
Run the following commands to change the permission of the wordpress folder.
find yourwordpressfolder -type d -exec chmod 755 {} \;
find yourwordpressfolder -type f -exec chmod 644 {} \;
On mac you can find terminal which is used as command line tool.

Unable to create directory wp-content/uploads/2014/07. Is its parent directory writable by the server?

Hi anyone can help me for this issue , I have developed a site and it is hosted on my development server but now my client wants to move it to his own production server, and my client doesn't have access to his cpanel for this server. I only have the ftp access, so I have added his database in my own development server, while in development I used my amazon s3 for storing the images , when I push to production I loss the amazon plugin . I can't able to install the plugin , so I moved to upload once again to those images through WordPress, now I face this error while uploading an image : Unable to create directory wp-content/uploads/2014/07. Is its parent directory writable by the server? , and change the ftp file permission access to 755 and changed the uploads file permission to 777 , Still I am not able to upload the images, can some one help me for this issue.
This is a problem of the Apache permissions. I had this problem and i broke my mind for many days to understand what was happening.
The correct way (USE IT):
(the solution that i used, and worked)
You need to give Rewrite permissions to the Apache.
For Ubuntu:
Run via ssh: chown -R www-data:www-data /var/www/the/wordpress/directory
For Centos:
Run via ssh: chown -R apache.apache /var/www/the/wordpress/directory
The Wrong Way (I don't recommend it, but works...)
You can change the permissions to 777 in all the paths that Wordpress need to change. wp-content/plugins recursively on folders to solve install/update problems, and wp-content/uploads recursively on folders to solve upload media problems.
Never use it because you are giving permissions to anyone change your files. A open way for the crackers that don't like you.
run these command to provide proper file permissions
Add existing 'ubuntu' user to 'www-data' group
sudo usermod -a -G www-data ubuntu;
Set the ownership of the files/directories
sudo chown -R www-data:www-data /var/www/html/;
Set group ownership inheritance
sudo chmod g+s /var/www/html/;
Set the permissions of the files/directories
sudo find /var/www/html/ -type d -exec chmod 755 {} ;
sudo find /var/www/html/ -type f -exec chmod 644 {} ;
Give write permissions to the group (for editing files via FTP)
sudo chmod -R g+w /var/www/html/;

Categories