Teman – teman yang sudah akrab dengan CMS WordPress terlebih lagi sering berpindah – pindah hosting tentu sudah tidak asing dengan yang namanya file wp-config.php. File tersebut terletak di dalam folder public_html.
Fungsi dari wp-config.php tentu sangat kompleks, namun kita sering mengeditnya guna menyesuaikan dengan informasi database yang digunakan. Jadi bisa di katakan bahwa wp-config.php adalah salah satunya berfungsi sebagai penghubung antara file web dengan database.
Cara Membuat (Kode / Script) wp-config.php Secara Manual Untuk WordPress
Pada kasus instalasi WordPress secara manual seperti di VPS atau instalasi WordPress di subdirektori atau subfolder seringkali kita diminta untuk membuat file wp-config.php dan menguploadnya ke direktori website.
Nah berikut ini script atau kode wp-config.php yang bisa kamu buat secara manual:
<?php /** * Custom WordPress configurations on "wp-config.php" file. * * This file has the following configurations: MySQL settings, Table Prefix, Secret Keys, WordPress Language, ABSPATH and more. * For more information visit {@link https://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php} Codex page. * Created using {@link http://generatewp.com/wp-config/ wp-config.php File Generator} on GenerateWP.com. * * @package WordPress * @generator GenerateWP.com */ /* MySQL settings */ define( 'DB_NAME', 'database_name_here' ); define( 'DB_USER', 'username_here' ); define( 'DB_PASSWORD', 'password_here' ); define( 'DB_HOST', 'localhost' ); define( 'DB_CHARSET', 'utf8mb4' ); /* MySQL database table prefix. */ $table_prefix = 'wp_'; /* Authentication Unique Keys and Salts. */ /* https://api.wordpress.org/secret-key/1.1/salt/ */ define( 'AUTH_KEY', 'put your unique phrase here' ); define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); define( 'NONCE_KEY', 'put your unique phrase here' ); define( 'AUTH_SALT', 'put your unique phrase here' ); define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); define( 'NONCE_SALT', 'put your unique phrase here' ); /* 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');
Lalu bagaimana cara membuat file .php ?
Caranya sangat mudah, tinggal:
- kamu buka Notepad atau aplikasi sejenisnya
- paste kode di atas
- simpan file tersebut dengan nama wp-config.php
jadi kamu tinggal menambahkan .php di akhir nama file atau ekstensi file tersebut, sangat mudah bukan?
Sekarang kamu tinggal upload file wp-config.php ke folder web kamu, silahkan sesuaikan DB_NAME, DB_USER dan DB_PASSWORD dengan informasi nama database, username database dan password database yang kamu guankan. Selamat mencoba !
terimakasih tutorialnya