Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Wordpress can't not write wp-config file

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 ?

enter image description hereenter image description here

Sorry about my poor english.

like image 682
seb Avatar asked Jan 12 '23 20:01

seb


1 Answers

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.

chown -R root:www-data /var/www/html/wordpress

I changed the permissions of my wordpress folder to 755 for directories and 644 for files, following the recommendations of other sites.

find /var/www/html/wordpress -type d -exec chmod 755 {} \;
find /var/www/html/wordpress -type f -exec chmod 644 {} \;

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:

find /var/www/html/wordpress -type d -exec chmod 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.

like image 93
John Avatar answered Jan 22 '23 07:01

John