Linux Wordpress can't write wp-config file

Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
I installed the latest version of Apache2 / PHP / MYSQL on my PC.
In the directory /src/www/htdocs I created a directory wordpress with all wordpress files.
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.php' 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 have seen lot of people saying change the group to www-data but I do not see www-data using this command:
cut -d: -f1 /etc/group
Anyone know what I am doing wrong?
permissions wordpress
add a comment |
up vote
5
down vote
favorite
I installed the latest version of Apache2 / PHP / MYSQL on my PC.
In the directory /src/www/htdocs I created a directory wordpress with all wordpress files.
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.php' 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 have seen lot of people saying change the group to www-data but I do not see www-data using this command:
cut -d: -f1 /etc/group
Anyone know what I am doing wrong?
permissions wordpress
The user and group that apache run as is set in/etc/apache2/envvarson my debian system.
– ctrl-alt-delor
Nov 25 '13 at 22:42
Look to see who wordpress/apache is running as. On my system it iswww-data, I would then have to make sure the files that it needs to change were owned by it (www-data).
– ctrl-alt-delor
Nov 25 '13 at 22:46
Changing owner and group to root can never increase permissions, as root already has permission.
– ctrl-alt-delor
Nov 25 '13 at 22:49
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I installed the latest version of Apache2 / PHP / MYSQL on my PC.
In the directory /src/www/htdocs I created a directory wordpress with all wordpress files.
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.php' 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 have seen lot of people saying change the group to www-data but I do not see www-data using this command:
cut -d: -f1 /etc/group
Anyone know what I am doing wrong?
permissions wordpress
I installed the latest version of Apache2 / PHP / MYSQL on my PC.
In the directory /src/www/htdocs I created a directory wordpress with all wordpress files.
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.php' 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 have seen lot of people saying change the group to www-data but I do not see www-data using this command:
cut -d: -f1 /etc/group
Anyone know what I am doing wrong?
permissions wordpress
permissions wordpress
edited May 10 '17 at 15:59
PdC
1839
1839
asked Nov 25 '13 at 20:49
seb
26112
26112
The user and group that apache run as is set in/etc/apache2/envvarson my debian system.
– ctrl-alt-delor
Nov 25 '13 at 22:42
Look to see who wordpress/apache is running as. On my system it iswww-data, I would then have to make sure the files that it needs to change were owned by it (www-data).
– ctrl-alt-delor
Nov 25 '13 at 22:46
Changing owner and group to root can never increase permissions, as root already has permission.
– ctrl-alt-delor
Nov 25 '13 at 22:49
add a comment |
The user and group that apache run as is set in/etc/apache2/envvarson my debian system.
– ctrl-alt-delor
Nov 25 '13 at 22:42
Look to see who wordpress/apache is running as. On my system it iswww-data, I would then have to make sure the files that it needs to change were owned by it (www-data).
– ctrl-alt-delor
Nov 25 '13 at 22:46
Changing owner and group to root can never increase permissions, as root already has permission.
– ctrl-alt-delor
Nov 25 '13 at 22:49
The user and group that apache run as is set in
/etc/apache2/envvars on my debian system.– ctrl-alt-delor
Nov 25 '13 at 22:42
The user and group that apache run as is set in
/etc/apache2/envvars on my debian system.– ctrl-alt-delor
Nov 25 '13 at 22:42
Look to see who wordpress/apache is running as. On my system it is
www-data, I would then have to make sure the files that it needs to change were owned by it (www-data).– ctrl-alt-delor
Nov 25 '13 at 22:46
Look to see who wordpress/apache is running as. On my system it is
www-data, I would then have to make sure the files that it needs to change were owned by it (www-data).– ctrl-alt-delor
Nov 25 '13 at 22:46
Changing owner and group to root can never increase permissions, as root already has permission.
– ctrl-alt-delor
Nov 25 '13 at 22:49
Changing owner and group to root can never increase permissions, as root already has permission.
– ctrl-alt-delor
Nov 25 '13 at 22:49
add a comment |
4 Answers
4
active
oldest
votes
up vote
4
down vote
If wp-config.php doesn't exist yet, use:
cp wp-config-sample.php wp-config.php
The group that apache uses is in an Apache config file. Here's how I find in on OS X. for me, the group is _www:
grep ^Group /etc/apache2/httpd.conf
There are 3 permissions groups that Unix/Linux uses - user, group, others. I'm assuming you'll want to remain the user that owns the file. The easiest thing to do is give write permission to the group and others. To do that, use:
chmod go+w wp-config.php
add a comment |
up vote
2
down vote
Just change the own of the folder from root to your current user.
sudo chown -R yourcurrentuser:currentgroup /srv/www/htdocs/wordpress
add a comment |
up vote
1
down vote
First, find out which group the Apache daemon is currently using:
$ cat /etc/apache2/apache2.conf | grep ^Group -B 2
# These need to be set in /etc/apache2/envvars
User $APACHE_RUN_USER
Group $APACHE_RUN_GROUP
OK. This means the group is stored in the APACHE_RUN_GROUP variable:
$ echo $APACHE_RUN_GROUP
That variable isn't set in the current environment. Why? I don't really know. But it doesn't matter, because the comment in the Apache config file points us to the file where these variables are defined:
$ cat /etc/apache2/envvars | grep GROUP
export APACHE_RUN_GROUP=www-data
So in my case, the group Apache is running under is www-data. With this info, now change the group of the WordPress directory. In your case:
sudo chgrp -R www-data /src/www/htdocs
The -R flag makes it recursive. Et voilà!
add a comment |
up vote
0
down vote
Manually create wp-config.php file and past the code which looks like this and re-install the same it will work.
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'landdb');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the @link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '>-QGUoR0nVWO9 rl=XOk}/yn[sZf=[HcZk8@J6Icm/:p#z+4jmJF]n~6m2y?n,TV');
define('SECURE_AUTH_KEY', '0Sq%,SJ5KP|]wvufKIfn0s4}.=Ln]UuPF8k<Zo]X]7^4;VT5q%UITl,!{7w2QM');
define('LOGGED_IN_KEY', 'A[sS*[ksr2!qf8G`=&3Z)=vOJGd%X|7k=49s9BZ7k|n7j_WhHPGw*SP.o]wvufKIfn0s4.=Ln]UuPF8k<Zo]X]7^4;VT5q%UITl,!{7w2QM');
define('LOGGED_IN_KEY', 'A[sS*[ksr2!qf8G`=&3Z)=vOJGd%X|7k=49s9BZ7k|n7j_WhHPGw*SP.o?W`#');
define('NONCE_KEY', '71
up vote
0
down vote
Manually create wp-config.php file and past the code which looks like this and re-install the same it will work.
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'landdb');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the @link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '>-QGUoR0nVWO9 rl=XOk/yn[sZf=[HcZk8@J6Icm/:p#z+4jmJF]n~6m2y?n,TV');
define('SECURE_AUTH_KEY', '0Sq%,SJ5KP.=Ln]UuPF8k<Zo]X]7^4;VT5q%UITl,!{7w2QM');
define('LOGGED_IN_KEY', 'A[sS*[ksr2!qf8G`=&3Z)=vOJGd%X|7k=49s9BZ7k|n7j_WhHPGw*SP.o]wvufKIfn0s4.=Ln]UuPF8k<Zo]X]7^4;VT5q%UITl,!{7w2QM');
define('LOGGED_IN_KEY', 'A[sS*[ksr2!qf8G`=&3Z)=vOJGd%X|7k=49s9BZ7k|n7j_WhHPGw*SP.o?W`#');
define('NONCE_KEY', '71xg#3i$Q)L aybW9KPvsRZ&PaV#[[Lc# # 6Q<Mk*7Pi6W(Qh`t$^s>/S:aT>z');
define('AUTH_SALT', 'qa-S$)X)-C(&~:TPD~WQlX,q788*NBCN_:3jGmr@X/yn[sZf=[HcZk8@J6Icm/:p#z+4jmJF]n~6m2y?n,TV');
define('SECURE_AUTH_KEY', '0Sq%,SJ5KP.=Ln]UuPF8k<Zo]X]7^4;VT5q%UITl,!{7w2QM');
define('LOGGED_IN_KEY', 'A[sS*[ksr2!qf8G`=&3Z)=vOJGd%X|7k=49s9BZ7k|n7j_WhHPGw*SP.o{?W`#');
define('NONCE_KEY', '71{xg#3i$Q)L aybW9KPvsRZ&PaV#[[Lc# # 6Q<Mk*7Pi6W(Qh`t$^s>/S:aT>z');
define('AUTH_SALT', 'qa-S$)X)-C(&~:TPD~WQlX,q788*NBCN_:3jGmr@X|@iAOAZ`~igO3>)Z+L[xQQr');
define('SECURE_AUTH_SALT', 'mXE7Glb~H)O<GgBXMJ.e( 5kjw4Wd<vgFLu5eCp%n03 e-&;5mL5J,aQ.M*RY7n8GtoN0aj-jzXC<');
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the Codex.
*
* @link https://codex.wordpress.org/Debugging_in_WordPress
*/
define('WP_DEBUG', false);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
edited May 24 '16 at 12:19
techraf
4,115102139
4,115102139
answered May 24 '16 at 11:48
user171837
1
1
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f102561%2flinux-wordpress-cant-write-wp-config-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The user and group that apache run as is set in
/etc/apache2/envvarson my debian system.– ctrl-alt-delor
Nov 25 '13 at 22:42
Look to see who wordpress/apache is running as. On my system it is
www-data, I would then have to make sure the files that it needs to change were owned by it (www-data).– ctrl-alt-delor
Nov 25 '13 at 22:46
Changing owner and group to root can never increase permissions, as root already has permission.
– ctrl-alt-delor
Nov 25 '13 at 22:49