Linux WordPress ne peut pas écrire le file wp-config

J'ai installé la dernière version d'Apache2 / PHP / MYSQL sur mon PC.

Dans le directory /src/www/htdocs j'ai créé un directory wordpress avec tous les files wordpress.

Ensuite, lorsque j'ai essayé de créer le file wp-config via l'interface web, j'ai eu cette erreur:

 Sorry, but I can't write the `wp-config.php' file. 

J'ai essayé cette command pour changer le groupe de /src/www/htdocs/wordpress

 chown -R root:root /srv/www/htdocs/wordpress 

Mais ça ne marchait pas. Après quelques searchs, j'ai vu beaucoup de gens dire changer le groupe en www-data mais je ne vois pas www-data utilisant cette command:

 cut -d: -f1 /etc/group 

Quelqu'un sait ce que je fais mal?

Si wp-config.php n'existe pas encore, utilisez:

 cp wp-config-sample.php wp-config.php 

Le groupe qu'apache utilise est dans un file de configuration Apache. Voici comment je trouve sur OS X. pour moi, le groupe est _www :

 grep ^Group /etc/apache2/httpd.conf 

Il y a 3 groupes d'permissions qu'Unix / Linux utilise – user , group , others . Je suppose que vous voulez restr l' user propriétaire du file. La chose la plus facile à faire est de donner la permission écrite au group et aux others . Pour cela, utilisez:

  chmod go+w wp-config.php 

Il suffit de changer le propre du dossier de la racine à votre user actuel.

 sudo chown -R yourcurrentuser:currentgroup /srv/www/htdocs/wordpress 

Tout d'abord, découvrez quel groupe le démon Apache utilise actuellement:

 $ 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} 

D'ACCORD. Cela signifie que le groupe est stocké dans la variable APACHE_RUN_GROUP :

 $ echo ${APACHE_RUN_GROUP} 

Cette variable n'est pas définie dans l'environnement actuel. Pourquoi? Je ne sais pas vraiment. Mais cela n'a pas d'importance car le commentaire dans le file de configuration Apache nous indique le file où ces variables sont définies:

 $ cat /etc/apache2/envvars | grep GROUP export APACHE_RUN_GROUP=www-data 

Donc dans mon cas, le groupe Apache fonctionne sous www-data . Avec cette information, changez maintenant le groupe du directory WordPress. Dans ton cas:

 sudo chgrp -R www-data /src/www/htdocs 

Le drapeau -R rend récursif. Et voilà!

Créer manuellement le file wp-config.php et passé le code qui ressemble à ceci et ré-installer le même cela fonctionnera.

 <?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;VT5}q%UITl,!{7w2QM'); define('LOGGED_IN_KEY', 'A[sS*[{ksr}2!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<GgB{XMJ.e|~=/t<z~mIQY.Dt=_b)IlUX=$qx@/]w<]bHt1?H(a7 '); define('LOGGED_IN_SALT', '=0T`7(nbT&n`%eOx0[fk%)v_ncoZf +Br&<Wi3N> Vy0XD/)w8?3xw2c9LOKlSR-'); define('NONCE_SALT', 'rvK~}( 5kjw4Wd<vgFLu5eCp%n03 e-&;5mL5J,aQ.M*RY{7n8GtoN}0aj-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');