6 * @subpackage Administration
13 <html xmlns="http://www.w3.org/1999/xhtml">
15 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16 <title>Error: PHP is not running</title>
18 <body class="wp-core-ui">
19 <p id="logo"><a href="https://wordpress.org/">WordPress</a></p>
20 <h1>Error: PHP is not running</h1>
21 <p>WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p>
28 * We are installing WordPress.
33 define( 'WP_INSTALLING', true );
35 /** Load WordPress Bootstrap */
36 require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
38 /** Load WordPress Administration Upgrade API */
39 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
41 /** Load WordPress Translation Install API */
42 require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
45 require_once( ABSPATH . WPINC . '/wp-db.php' );
49 $step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
52 * Display install header.
56 * @param string $body_classes
58 function display_header( $body_classes = '' ) {
59 header( 'Content-Type: text/html; charset=utf-8' );
61 $body_classes .= 'rtl';
63 if ( $body_classes ) {
64 $body_classes = ' ' . $body_classes;
68 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
70 <meta name="viewport" content="width=device-width" />
71 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
72 <meta name="robots" content="noindex,nofollow" />
73 <title><?php _e( 'WordPress › Installation' ); ?></title>
75 wp_admin_css( 'install', true );
76 wp_admin_css( 'dashicons', true );
79 <body class="wp-core-ui<?php echo $body_classes ?>">
80 <p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p>
83 } // end display_header()
86 * Display installer setup form.
90 * @param string|null $error
92 function display_setup_form( $error = null ) {
95 $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->users ) );
96 $user_table = ( $wpdb->get_var( $sql ) != null );
98 // Ensure that Blogs appear in search engines by default.
100 if ( isset( $_POST['weblog_title'] ) ) {
101 $blog_public = isset( $_POST['blog_public'] );
104 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
105 $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
106 $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : '';
108 if ( ! is_null( $error ) ) {
110 <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1>
111 <p class="message"><?php echo $error; ?></p>
113 <form id="setup" method="post" action="install.php?step=2" novalidate="novalidate">
114 <table class="form-table">
116 <th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th>
117 <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td>
120 <th scope="row"><label for="user_login"><?php _e('Username'); ?></label></th>
124 _e('User(s) already exists.');
125 echo '<input name="user_name" type="hidden" value="admin" />';
127 ?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" />
128 <p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p>
133 <?php if ( ! $user_table ) : ?>
134 <tr class="form-field form-required user-pass1-wrap">
137 <?php _e( 'Password' ); ?>
142 <?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?>
143 <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
144 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
145 <span class="dashicons dashicons-hidden"></span>
146 <span class="text"><?php _e( 'Hide' ); ?></span>
148 <div id="pass-strength-result" aria-live="polite"></div>
150 <p><span class="description important hide-if-no-js">
151 <strong><?php _e( 'Important:' ); ?></strong>
152 <?php /* translators: The non-breaking space prevents 1Password from thinking the text "log in" should trigger a password save prompt. */ ?>
153 <?php _e( 'You will need this password to log in. Please store it in a secure location.' ); ?></span></p>
156 <tr class="form-field form-required user-pass2-wrap hide-if-js">
158 <label for="pass2"><?php _e( 'Repeat Password' ); ?>
159 <span class="description"><?php _e( '(required)' ); ?></span>
163 <input name="admin_password2" type="password" id="pass2" autocomplete="off" />
167 <th scope="row"><?php _e( 'Confirm Password' ); ?></th>
170 <input type="checkbox" name="pw_weak" class="pw-checkbox" />
171 <?php _e( 'Confirm use of weak password' ); ?>
177 <th scope="row"><label for="admin_email"><?php _e( 'Your Email' ); ?></label></th>
178 <td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" />
179 <p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
182 <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?></th>
185 <legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
187 if ( has_action( 'blog_privacy_selector' ) ) { ?>
188 <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> />
189 <label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/>
190 <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> />
191 <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
192 <p class="description"><?php _e( 'Note: Neither of these options blocks access to your site — it is up to search engines to honor your request.' ); ?></p>
194 /** This action is documented in wp-admin/options-reading.php */
195 do_action( 'blog_privacy_selector' );
197 <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( 0, $blog_public ); ?> />
198 <?php _e( 'Discourage search engines from indexing this site' ); ?></label>
199 <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
205 <p class="step"><?php submit_button( __( 'Install WordPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p>
206 <input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" />
209 } // end display_setup_form()
211 // Let's check to make sure WP isn't already installed.
212 if ( is_blog_installed() ) {
215 '<h1>' . __( 'Already Installed' ) . '</h1>' .
216 '<p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p>' .
217 '<p class="step"><a href="' . esc_url( wp_login_url() ) . '" class="button button-large">' . __( 'Log In' ) . '</a></p>' .
223 * @global string $wp_version
224 * @global string $required_php_version
225 * @global string $required_mysql_version
228 global $wp_version, $required_php_version, $required_mysql_version;
230 $php_version = phpversion();
231 $mysql_version = $wpdb->db_version();
232 $php_compat = version_compare( $php_version, $required_php_version, '>=' );
233 $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
235 if ( !$mysql_compat && !$php_compat )
236 $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.' ), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
237 elseif ( !$php_compat )
238 $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_php_version, $php_version );
239 elseif ( !$mysql_compat )
240 $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_mysql_version, $mysql_version );
242 if ( !$mysql_compat || !$php_compat ) {
244 die( '<h1>' . __( 'Insufficient Requirements' ) . '</h1><p>' . $compat . '</p></body></html>' );
247 if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) {
250 '<h1>' . __( 'Configuration Error' ) . '</h1>' .
252 /* translators: %s: wp-config.php */
253 __( 'Your %s file has an empty database table prefix, which is not supported.' ),
254 '<code>wp-config.php</code>'
255 ) . '</p></body></html>'
259 // Set error message if DO_NOT_UPGRADE_GLOBAL_TABLES isn't set as it will break install.
260 if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
263 '<h1>' . __( 'Configuration Error' ) . '</h1>' .
265 /* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
266 __( 'The constant %s cannot be defined when installing WordPress.' ),
267 '<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
268 ) . '</p></body></html>'
273 * @global string $wp_local_package
274 * @global WP_Locale $wp_locale
277 if ( ! empty( $_REQUEST['language'] ) ) {
278 $language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] );
279 } elseif ( isset( $GLOBALS['wp_local_package'] ) ) {
280 $language = $GLOBALS['wp_local_package'];
283 $scripts_to_print = array( 'jquery' );
287 if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
288 $scripts_to_print[] = 'language-chooser';
289 display_header( 'language-chooser' );
290 echo '<form id="setup" method="post" action="?step=1">';
291 wp_install_language_form( $languages );
296 // Deliberately fall through if we can't reach the translations API.
298 case 1: // Step 1, direct link or from language chooser.
299 if ( ! empty( $language ) ) {
300 $loaded_language = wp_download_language_pack( $language );
301 if ( $loaded_language ) {
302 load_default_textdomain( $loaded_language );
303 $GLOBALS['wp_locale'] = new WP_Locale();
307 $scripts_to_print[] = 'user-profile';
311 <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1>
312 <p><?php _e( 'Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ); ?></p>
314 <h2><?php _e( 'Information needed' ); ?></h2>
315 <p><?php _e( 'Please provide the following information. Don’t worry, you can always change these settings later.' ); ?></p>
318 display_setup_form();
321 if ( ! empty( $language ) && load_default_textdomain( $language ) ) {
322 $loaded_language = $language;
323 $GLOBALS['wp_locale'] = new WP_Locale();
325 $loaded_language = 'en_US';
328 if ( ! empty( $wpdb->error ) )
329 wp_die( $wpdb->error->get_error_message() );
331 $scripts_to_print[] = 'user-profile';
334 // Fill in the data we gathered
335 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
336 $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
337 $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : '';
338 $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : '';
339 $admin_email = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : '';
340 $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 1;
342 // Check email address.
344 if ( empty( $user_name ) ) {
346 display_setup_form( __( 'Please provide a valid username.' ) );
348 } elseif ( $user_name != sanitize_user( $user_name, true ) ) {
349 display_setup_form( __( 'The username you provided has invalid characters.' ) );
351 } elseif ( $admin_password != $admin_password_check ) {
353 display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
355 } elseif ( empty( $admin_email ) ) {
357 display_setup_form( __( 'You must provide an email address.' ) );
359 } elseif ( ! is_email( $admin_email ) ) {
361 display_setup_form( __( 'Sorry, that isn’t a valid email address. Email addresses look like <code>username@example.com</code>.' ) );
365 if ( $error === false ) {
366 $wpdb->show_errors();
367 $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language );
370 <h1><?php _e( 'Success!' ); ?></h1>
372 <p><?php _e( 'WordPress has been installed. Thank you, and enjoy!' ); ?></p>
374 <table class="form-table install-success">
376 <th><?php _e( 'Username' ); ?></th>
377 <td><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></td>
380 <th><?php _e( 'Password' ); ?></th>
382 if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ): ?>
383 <code><?php echo esc_html( $result['password'] ) ?></code><br />
385 <p><?php echo $result['password_message'] ?></p>
390 <p class="step"><a href="<?php echo esc_url( wp_login_url() ); ?>" class="button button-large"><?php _e( 'Log In' ); ?></a></p>
397 if ( ! wp_is_mobile() ) {
399 <script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
403 wp_print_scripts( $scripts_to_print );
405 <script type="text/javascript">
406 jQuery( function( $ ) {
407 $( '.hide-if-no-js' ).removeClass( 'hide-if-no-js' );