官术网_书友最值得收藏!

  • Drupal 7 First Look
  • Mark Noble
  • 389字
  • 2021-04-13 16:46:23

Command-line installation

Administrators who manage lots of sites or who prefer to work from the command line will be thrilled with the change to make Drupal installable from the command line. If you want to run the installation from the command line, you will need to use the following procedure:

  1. Download Drupal from Drupal.org and copy the files to your server.
  2. Create a PHP script to run the Drupal command line using the following procedure:

    i. Create a file called install.site.php where site is the name of your site. This file should be located in the same directory where your install.php file is located (the root directory for your site).

    ii. Open the install.site.php file in your favorite file editor.

    iii. Enter the following script:

    <?php
    include_once 'install.php';
    
    $settings = array(
      'parameters' => array(
        'profile' => 'default',
        'locale' => 'en',
      ),
      'forms' => array(
        'install_settings_form' => array(
          'driver' => 'mysql',
          'database' => 'my_db_name',
          'username' => 'my_db_username',
          'password' => 'my_db_password',
        ),
        'install_configure_form' => array(
          'site_name' => 'My site',
          'site_mail' => 'admin@example.com',
          'account' => array(
            'name' => 'admin',
            'mail' => 'admin@example.com',
            'pass' => array(
              'pass1' => 'my_site_password',
              'pass2' => 'my_site_password',
            ),
          ),
          'update_status_module' => array(1 => TRUE),
          'clean_url' => TRUE,
        ),
      ),
    );
    install_drupal($settings);
    ?>

    This code is used to configure the installation so Drupal knows what values to use during the installation process to properly configure your site as it is created.

    iv. Modify the values in the above code snippet to match the needs of the site you want to install. You will need to pay special attention to the database information including the database name, username, and password. You should also modify the administrator's password, site name, and so on to match the desired values for your site.

    v. Save the file with all of your changes.

  3. Run the install.site.php file from the command line using the syntax:
    php install.site.php 
    
  4. After the installation completes, you can verify your site and begin configuring it as usual.
  5. After completing the installation, you should back up the install file and either remove it from your site completely or remove access to the file for all users since it contains the login information for User 1.

Although this setup is a little more complicated to run initially, it can be a big time saver if you are installing a large number of sites or want to run an unattended installation.

主站蜘蛛池模板: 龙口市| 龙山县| 霍城县| 哈巴河县| 黄石市| 普宁市| 漠河县| 宜君县| 韶山市| 阜平县| 苏尼特右旗| 盐源县| 民勤县| 保定市| 赤城县| 泗水县| 广丰县| 茶陵县| 五峰| 望城县| 郁南县| 永嘉县| 阿克陶县| 南通市| 色达县| 无锡市| 咸丰县| 图木舒克市| 长治县| 延庆县| 怀集县| 通道| 兴国县| 宁德市| 静安区| 唐河县| 枣强县| 青海省| 栾川县| 阳东县| 鹤山市|