I installed the latest version of Apache2 / PHP / MYSQL on my pc
In the directory /srv/www/htdocs I created a directory wordpress with all wordpress file.
Then, when I tried to create the wp-config file through the web interface I get this error :
Sorry, but i can't write the wp-config file.
I tried this command to change the group of /src/www/htdocs/wordpress
chown -R root:root /srv/www/htdocs/wordpress
But it was not working. After some research, i seen lot of people saying to change the group to www-data
but i do not see www-data
using this commande :
cut -d: -f1 /etc/group
Anyone know what I am doing wrong ?
Sorry about my poor english.
This is what worked for me. (I’m a beginner and I’m using Debian 8)
First I checked the Apache config file to find the group that apache uses. In my case it was www-data.
grep ^Group /etc/apache2/httpd.conf
I checked my /etc/group file and the group www-data was there.
Then I changed the group ownership of my wordpress directory from root to www-data.
I changed the permissions of my wordpress folder to 755 for directories and 644 for files, following the recommendations of other sites.
But since we want to give write permissions to the group www-admin for the wordpress folder and subfolders, I changed the permissions for directories to 775:
Then it worked: All right, sparky! Youâve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now toâ¦
Notes: The username and password of my myssql database was root/root. The username I was using to login to my computer was root and the password was something different than root. Just in case I changed my password to root, so the credentials of mysql and my local account are the same. I don’t know if by having the same name (root) they are the same account.
Sounds like
www-data
is not the group name used by apache on your system. To find what it actually uses, try the following:(That’s a capital O, not a zero). The column GID (probably the second column) is the numeric group ID that apache is running under. Look up its name in
/etc/group
.I had this problem in my
ubuntu 20.04
,WordPress 5.x
. I solved this issue with these steps:Even though I implemented CHOWN & CHMOD steps, but the issue was still persisting, then I found another scenario where this/same error could occur because of SELINUX CONTEXT issue (lack of write permission context).
To solve that – You can change Apache/HTTPD write context with in the web-content folder like this (Specific to the Debian environment, as mentioned in this question):
OR (on CentOS/Fedora):
You can validate the output like this (on CentOS/Fedora):
Notice the output of below command having changed RW (Read/Write) context on html (web-content) folder:
NOTE: Do validate the Path, Web Server User-Names, and SELINUX write-context as per your environment before executing above commands.
You have to need permission….. Just open the terminal and execute:
sudo chmod -R 777 /opt/lampp/htdocs/yourfolder
Example output