In the real world even advanced hosting management platforms like Plesk may experience issues. To solve such issues Plesk features diagnostic and self-repair tool, which effectively hunts down and fixes problems within the Plesk software itself as well as within its own suite of services. So, for instance, if you find that mail is failing to send, or a website doesn’t want to open, you can use the Plesk repair utility not just to analyse the problem but also to try and fix it.
You can ask it to search for and fix any problems affecting just one individual aspect of Plesk or you can set it loose on all the aspects at the same time.
To start the Plesk repair utility, log on to the server using SSH (if you’re a Linux user), or RDP (for Windows users), and type “plesk repair”. Follow this with the aspect and the option you want it to investigate, like this:
plesk repair ASPECT [OPTION]
The Plesk repair utility has three modes, called interactive, diagnostic and repair. Here’s what they do:
- Interactive mode. This one is the default mode. Whenever the Plesk repair utility discovers a problem or needs to modify a particular service, it lets you know about it. Then it tells you it’s going to try and fix the problem and will ask for your permission to do so.With some operations (like fixing problems that arise from missing PHP handlers, for instance) you can’t just respond with a yes or no. In these cases, the Plesk repair utility presents you with a number of options and you need to select one of them, which is why you need to be in interactive mode to do this (because you have to interact with it, right?). If an operation needs this kind of input, then it will be noted in the descriptions of the aspects that relate to it.
- Diagnostic mode. The Plesk repair utility lets you know that’s it’s identified problems, but that’s all it does. It just highlights what’s wrong, but there are no repairs. To go into diagnostic mode, typing the Plesk repair command and follow it with the -n option.
- Repair mode. With this one, the Plesk repair utility tries to fix any problems it finds, and it also re-configures some services, even if it didn’t find anything wrong. To switch to repair mode, use the Plesk repair command along with the -y option.
You replace the ASPECT part of the command (shown above) with one of the aspects in this list. Click on each of them for explanations and examples of where to use them:
- all – includes all the aspects below.
- mail – identifies and deals with mail server problems
- web – identifies and deals with web server problems
- dns – identifies and deals with DNS server problems
- ftp – identifies and deals with FTP server problems
- db – identifies and deals with Plesk database problems
- fs – identifies and deals with file system problems
- mysql – identifies and deals with MySQL problems
- mssql – identifies and deals with Microsoft SQL Server problems
- installation – identifies and deals with problems with Plesk itself
Some operations offer extended output. To view them, enter the following command:
plesk repair ASPECT -v
Any time the utility identifies a problem, it labels it as either a warning or an error, depending on how severe it is. When it’s completed its analysis, the utility displays an exit code that relates to how severe the problems are:
- ‘1’ shows that problems are identified as errors.
- ‘0’ shows that problems are identified as warnings, or if no problems were found.
After it’s detected problems, you can make the Plesk repair utility show exit code ‘1’ by running this command:
plesk repair ASPECT -treat-warnings-as-errors
To get help for the Plesk repair utility, run the Plesk repair command with the help option, like this:
plesk help repair
For help with one particular aspect of the utility, run the same command but include the aspect you want to know more about:
plesk help repair [ASPECT]
Plesk Repair Utility: All
If you want to run every single check you should specify the all flag. All checks everything included under every other flag. Plesk repair all will do a complete and full check of every aspect of your server. Keep in mind that if you have a lot of domains on your server running plesk repair all will take a long time to execute, while increasing server load. Under these circumstances we recommend running plesk repair all during quiet hours.
- plesk repair all: Run this command to check the Plesk installation and all Plesk services. You will automatically be in Interactive mode so when an issue is detected you will be prompted for your permission to fix the issue.
- plesk repair all -y: also checks everything about Plesk, but the -y option means that the utility will run in Repair mode, automatically fixing anything it detects as faulty.
- plesk repair all -n: add the -n option if you only want to run Plesk repair in diagnostic mode. The -n option will check all aspects of the Plesk installation and services and inform you of any issues it detects. -n will not resolve any issues.
Plesk Repair Utility: Mail
You can reconfigure mail settings for all domains and mailboxes by running the Plesk repair utility with the mail flag. You can customize the mail flag by adding any of the following flags:
- -restore-configuration: With this option you instruct the Plesk utility to restore the default configuration for the mail server. Plesk checks your mail server configuration every 24 hours and makes a snapshot of this configuration if it detects a change. Using -restore-configuration means that Plesk backs up your current configuration files. You are then offered a list of the available snapshots and the associated dates. Next, you can select the snapshot you want to restore. This option is only available in interactive mode, and only on Linux.
- -only-domain-settings: add this tag if you only want to reconfigure the mail settings for your domains, without making any changes to mailbox settings. Only available on Linux.
- -dont-restore-password: Use this option for specific mailboxes and domains, and only on Windows. This option reconfigures mail settings but does not synchronize the mailbox passwords between the mail server and the Plesk database.
When you run the repair utility you can specify that only specific domains or specific mailboxes are reconfigured.
Examples of restricting configuration to specific domains and mailboxes:
- plesk repair mail – Run this command and you will reconfigure the mail settings for every mailbox under every domain. This command runs in Interactive mode – whenever an issue is detected you will be prompted for your permission to resolve the issue.
- plesk repair mail mysuperbmail.com – Reconfigure the mail settings for all mailboxes belonging to the example.com domain, as well as domain-wide mail settings.
- plesk repair mail [email protected] – Reconfigure the mail settings for the [email protected] mailbox.
Plesk Repair Utility: Web
When you use the Plesk repair utility with the web flag you regenerate the configuration files for your web server and for every domain. This flag also gives you the option to reinstall SSL certificates and will also resolve any issues with corrupt or missing PHP handlers. You can further customise this flag by adding any of the following options at the end:
- -domains-only: only regenerate the configuration files for domains.
- -sslcerts: configures all server IP addresses to use the default SSL certificate. Also reinstalls every SSL certificate in use.
- -filesharing: Refers to Plesk database and updates the file containing sharing passwords and permission for authorised users.
- -webmail: Windows-only, this reconfigures the webmail site inside of IIS
- -validate-configuration: Linux-only, this option validates the Apache configuration
- -server: Linux-only, this option regenerates the Apache configuration file
- -php-handlers: For unregistered PHP handlers, this option triggers a check for the service plans and domains. Only applicable in interactive mode.
You can specify individual domains to regenerate the configuration for the specified domains only.
- plesk repair web – Regenerate the configuration files for the web server and all domains.
- plesk repair web -server – Regenerate the configuration files for the web server only.
- plesk repair web -domains-only – Regenerate the configuration files for domains only.
- plesk repair web mysuperbweb.com – Regenerate the configuration files for the example.com domain only.
- plesk repair web -sslcerts – Reinstall all SSL certificates and configure all IP addresses to use the default SSL certificate.
Plesk Repair Utility: DNS
Using the Plesk repair utility with the dns aspect synchronizes the DNS zones information between the DNS server and the Plesk database. The following options are specific to this aspect:
- -sync-zones – Performs the synchronization without confirmation. Acts identically to -y.
- plesk repair dns – Synchronizes the DNS zones information between the DNS server and the Plesk database.
Plesk Repair Utility: FTP
Another very useful Plesk repair utility flag is the ftp flag. Ftp checks system users and the associated directories for consistency. With ftp you have the following additional options you can specify:
- -sys-users: Linux-only, this is a consistency check for system users.
- -host-name: Specific to Windows, this option checks that the host name is no longer than 15 symbols.
- -root-dir: Specific to Windows, this option checks that the root path for FTP does not have any characters that are “spaces” and that the root paths exists on the file system
- -domains-resolving: Checks that domain names resolve to the appropriate IP addresses (Windows only).
- -home-dir: Checks the home directories of additional FTP users (Windows only).
- -junctions: Checks that FTP home junctions exist and point to the home directories of corresponding users (Windows only).
- plesk repair ftp – Check the system users and their directories for consistency.
Plesk Repair Utility: File System
If you are concerned about file structure integrity you should use the fs flag. The Plesk repair utility will check system files, especially system files critical to Plesk, plus virtual hosts files on your server when you use the fs flag. Optionally you can specify that only certain domains are checked.
Important: The fs flag is only applicable to Plesk repair installations on Linux machines.
When you run the repair utility with the fs flag you are able to detect and repair the following issues:
- File and directory owners that are not proper
- File and directory permissions that are not proper
- File and directory extended attributes that are not proper
Running the repair utility with the fs flag will also detect any mandatory files and mandatory directories that are not present. However, these cannot be fixed automatically.
The fs flag can be further customised by adding one of the following options:
- -system: Forces the utility to only check system files, including system files critical for the operation of Plesk
- -vhosts: Forces the utility to only check the files of virtual hosts
Should none of the above options be included, the utility will simply check both system files and virtual hosts’ files.
Should an individual domain name be specified the utility will only check files for this domain. When a specific domain is specified additional options including -system and -vhosts will be ignored.
- plesk repair fs – Check both the virtual hosts’ files and the system files on the server.
- plesk repair fs -vhosts – Check only the virtual hosts’ files on the server.
- plesk repair fs –system – Check only the system files on the server.
- plesk repair fs superbhost.com – Check the files of the superbhost.com virtual host only.
- plesk repair fs superbhost.com -vhosts – Check the files of the superbhost.com virtual host only. In this case the –vhosts option is ignored.
- plesk repair fs –system –v –n – Give the detailed information about any detected issues of the system files, but do not resolve them.
Plesk Repair Utility: Plesk Database
Check the Plesk database for consistency by using the Plesk repair utility in conjunction with the db flag. The db flag check both system tools and tools specific to Plesk. If the tool finds any issues it will create a database dump and attempt to correct the problems with the database. There are no further flags or options that can be specified alongside db.
- plesk repair db – Check the Plesk database for consistency.
Plesk Repair Utility: File System
Check validity of virtual hosts’ directories and directory structures using the fs flag. The fs flag will also recreate directories that are missing and will correct permissions. The flag fs allows you to specify individual domains to be checked. There are no further options for this flag.
- plesk repair fs – Check the integrity of the virtual hosts’ directories and their structure.
- plesk repair fs mysuperbhost.com – Check the integrity and structure of mysuperbhost.com virtual host directories.
Plesk Repair Utility: MySQL
The mysql flag checks the availability of MySQL databases and will verify the integrity of MySQL databases and the database users. You have the following additional options with this flag:
- -connection: Verifies that MySQL database servers that are registered with Plesk are available and that connectivity is live.
- -databases: Verifies that every MySQL database created in Plesk exists on the database servers and recreates any missing databases.
- -database-users: Verifies that the MySQL database users created in Plesk exist on database servers. This options also checks that user privileges are correct, fixing any incorrect privileges. This option also recreates users that are missing from databases.
- plesk repair mysql – Check the availability of MySQL database servers and verify the integrity of MySQL databases and database users.
- plesk repair mysql -connection – Check that the MySQL database servers registered in Plesk are available and can be connected to.
- plesk repair mysql -database-users – Check that all MySQL database users created in Plesk exist on the database servers. Checks database users’ privileges and corrects them in case of discrepancies. Recreates any database users that are missing.
Plesk Repair Utility: Microsoft SQL Server
Using the Plesk repair utility with the mssql option checks Microsoft SQL Server database servers while also verifying the validity of Microsoft SQL Server database users and the actual databases. The following options applies and can be specified next to this flag:
- plesk repair mssql: Use this flag to verify the validity of Microsoft SQL servers and verify the integrity of every Microsoft SQL database and its users
- plesk repair mssql -connection: Use this option to verify that Microsoft SQL databases are registered in Plesk, and that these databases are available.
- plesk repair mssql -database-users: Use this option to verify that every Microsoft SQL database user that is in Plesk also exist on the database server. This option also verifies that user privileges are correct and fixes any problems with user privileges. Any database users that are missing are recreated.
- plesk repair mssql – Check the availability of Microsoft SQL database servers and verify the integrity of Microsoft SQL databases and database users.
- plesk repair mssql -connection – Check that the Microsoft SQL database servers registered in Plesk are available and can be connected to.
- plesk repair mssql -database-users – Check that all Microsoft SQL database users created in Plesk exist on the database servers. Checks database users’ privileges and corrects them in case of discrepancies. Recreates any database users that are missing.
Plesk Repair Utility: Installation
The installation flag in the Plesk repair utility will check the consistency of the actual Plesk installation. This flag should be used if you are experiencing problems with Plesk itself and not one of the individual Plesk services. This flag does not have any additional options.
- plesk repair installation – Check the consistency of the Plesk installation.