Manual:Maintenance scripts/Running the scripts/zh

维护脚本必须从命令行运行. Users who do not access the server directly from its terminal will usually establish a connection through SSH.


 * For Linux/Unix users this is by using the SSH client in a shell.
 * For Windows users, one can use the SSH command line tool introduced in Windows 10 or alternatively use a third-party tool such as PuTTY shown below or use Windows Subsystem for Linux.

Linux/MacOS user
Most the Linux system and MacOS comes SSH client built-in. So you don't need to any SSH client. You can check SSH client in your system by running following command in your terminal.

If this command gives error then you need to install SSH client in your system.

Debian/Ubuntu -

MacOS -

Once you get the SSH client in your system then you can run following command to get into server.

The default port for SSH connection is  and user is. But shared hosting provider gives the custom user and SSH port number. Replace these values with yours. Now, you can run the MediaWiki maintenance script on server.

Windows user
For Windows user, there are two ways to get into server.

Native SSH client
You can install/enable SSH client using Windows Settings on Windows Server 2019 and Windows 10 devices. They support the SSH natively. See [ https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse Official doc].

To install the OpenSSH component:


 * Open, select   >  , then select.
 * Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select, then:
 * Find  Client, then click.

It will install the SSH client in your system. Now, you can SSH to server using PowerShell.

The default port for SSH connection is  and user is. But shared hosting provider gives the custom user and SSH port number. Replace these values with yours.

Now, you can run the MediaWiki maintenance script on server.

Putty (or other 3rd party SSH client)
You can use Putty or other 3rd party SSH client on Windows machine. Please follow below slideshow from Step 1 to Step 4.

Now, you can run the MediaWiki maintenance script on server.

Running the script
Once you get into to the server (See "Get into server" above) then you can follow these steps.

Step 1: Goto the MediaWiki root directory. In most cases, it would be

Step 2: Run the script

If you are using Windows server and get an error (for example: php.exe is no valid Win32 application), try the following.

or

Standard command-line options
Almost every PHP script in  supports several standard options:

MediaWiki installs that use symlinks
In cases where the MediaWiki PHP files are symlinked to a central installation, you will need to specify to the maintenance script the path of the LocalSettings.php file. For example:

MediaWiki installs that use shared settings (family type)
Sometimes MediaWiki is installed as a family for many languages and settings (LocalSettings.php) are split to common part and language parts (see ) where common part is located outside of  directory and accessed using relative link. In this case maintenance scripts will not work when running them in  directory. Run them from  directory instead.

No shell access
On many shared hosts, you won't have shell access. The following extensions may be useful to run maintenance scripts via the web.