Is there anyone who has the idea that how to create authors for wordpress by php programmatically?
Try this
$user_id = username_exists( $user_name );
if ( !$user_id and email_exists($user_email) == false ) {
$random_password = wp_generate_password( $length=12, $include_standard_special_chars=false );
$user_id = wp_create_user( $user_name, $random_password, $user_email );
wp_update_user(array(
'ID' => $user_id,
'role' => 'Author'
));
} else {
$random_password = __('User already exists.');
}