Tutorials

Installing WordPress manually on your hosting

Step-by-step tutorial for installing WordPress on hosting: downloading files, creating a MySQL database, editing wp-config.php, and fixing the most common installation errors. Suitable for beginners.

Tutorials

Installing WordPress on hosting, contrary to what many think, is not a complicated task. Although most hosts today offer automatic installation tools like Softaculous or Fantastico, manual installation gives you full control, speeds up troubleshooting, and when an error occurs, you know exactly where the problem is. In this guide, we will walk through the WordPress installation process step by step, from downloading files to fixing common errors, with technical details. If your host uses cPanel or DirectAdmin (which almost all Iranian and foreign hosts do), this tutorial is written exactly for you.

WordPress Installation Prerequisites

Before you start, make sure your hosting meets at least these specifications. WordPress doesn't require a lot of resources, but newer versions have become more demanding:

  • PHP version 7.4 or higher (versions 8.0 and 8.1 are recommended)
  • MySQL version 5.7 or higher, or MariaDB version 10.3 and above
  • Hosting space at least 500 MB to start (though for a real website, 2 GB or more is more reasonable)
  • Access to the File Manager in your hosting panel or an FTP client like FileZilla
  • Access to phpMyAdmin to create the database

To check your hosting's PHP version, you can create a file named info.php and put the following code inside it:

<?php phpinfo(); ?>

Then upload the file to the public_html folder and open https://yourdomain.com/info.php in your browser. If the PHP version is low, change it from the "Select PHP Version" section in cPanel. After checking, be sure to delete the file because it exposes your server information.

Step 1: Download and Upload WordPress Files

Go to the official site wordpress.org/download and download the latest version as a compressed file (zip or tar.gz). Extract the downloaded file on your system. Inside the folder, you'll see files like wp-admin, wp-content, wp-includes, and files like wp-config-sample.php and index.php.

Now you have two options:

  • Install on the main domain (like example.com): Upload all folder contents into public_html.
  • Install on a subdomain or subfolder (like example.com/blog): Create a new folder in public_html and upload the files into it.

For uploading, you can use the File Manager in your hosting panel. If the file size is large (usually 50 to 80 MB), it's better to upload the zip file and use the Extract option in the File Manager. This is much faster than uploading files one by one.

Common Mistake: Uploading a Nested Folder

Many users upload the zip file and after extracting, a structure like public_html/wordpress/wp-admin is created. In this case, the site opens at example.com/wordpress instead of example.com. If you want WordPress on the main domain, you need to move the contents of the wordpress folder directly into public_html, not the folder itself.

Step 2: Create a MySQL Database

WordPress needs a database to store content, settings, and users. Log into cPanel and click on the MySQL Databases icon. Follow these steps in order:

  1. In the "Create New Database" section, enter a name. The panel usually adds a prefix like cpaneluser_ to your name. For example, if you enter wpdb, the full database name becomes cpaneluser_wpdb. Write down this full name.
  2. In the "Add New User" section, create a username and a strong password. The username will also be saved with a prefix. Store the password in a safe place.
  3. Go to the "Add User to Database" section, select the user and the created database, and click the Add button.
  4. In the popup window, select ALL PRIVILEGES and click Make Changes.

If your host uses DirectAdmin, the path is slightly different: you create the database and user from the MySQL Management menu, then grant full access (ALL) in the "Manage Permissions" section.

Security Tip: Database Password

Don't use simple passwords like 123456 or password. Create a 16-character password with a combination of uppercase letters, lowercase letters, numbers, and symbols. You can use the Password Generator tool inside cPanel itself.

Step 3: Create the wp-config.php File

In the WordPress folder, there's a file named wp-config-sample.php. Rename this file to wp-config.php (or make a copy with this name). Now open the file with a text editor like Notepad++ or the File Manager's own editor.

Find the following sections and replace the values with your database information:

define( 'DB_NAME', 'cpaneluser_wpdb' );
define( 'DB_USER', 'cpaneluser_wpuser' );
define( 'DB_PASSWORD', 'YourStrongPasswordHere' );
define( 'DB_HOST', 'localhost' );

The DB_HOST value is usually localhost, but some hosts use a different address like mysql.hosting.com. If you're not sure, ask your hosting support or check your hosting welcome email.

Security Keys (Salt Keys)

In the same file, there's a section called Authentication Unique Keys and Salts. Remove the default values and replace them with new keys from https://api.wordpress.org/secret-key/1.1/salt/. This significantly increases the security of your site's user sessions (cookies). Just open the page, copy all the generated lines, and replace them.

Table Prefix

In the following line, change the prefix value from wp_ to a custom value like myprefix_:

$table_prefix = 'myprefix_';

This simple action increases your site's security against SQL Injection attacks that focus on the default wp_ prefix.

Step 4: Run the WordPress Installation

Now everything is ready. Open your domain address in the browser (e.g., https://example.com). If you uploaded the files to a subfolder, enter the address with the folder name (like https://example.com/blog). WordPress will automatically display the installation page.

On this page, you need to enter the following information:

  • Site Title: Your site's name
  • Username: Administrator username (don't use admin; this name is a common target for Brute Force attacks)
  • Password: Strong password for the administrator
  • Your Email: Valid email to receive notifications
  • Search Engine Visibility: Enable this option during development so Google doesn't index your site. After launching, disable it.

Click the Install WordPress button. If you've done all the steps correctly, you'll see a success message and can log into the Dashboard.

Fixing Common WordPress Installation Errors

If you encounter an error at any step, don't worry. Almost all WordPress installation errors have a specific solution. Let's review the most common ones.

"Error establishing a database connection"

This is the most common error and means WordPress cannot connect to the database. Possible reasons:

  • The database name, user, or password in wp-config.php is incorrect. Double-check that you've entered the full name with the cPanel prefix.
  • The DB_HOST value is wrong. If localhost doesn't work, ask your host for the exact MySQL host address.
  • The database user is not connected to the database. Go back to the MySQL Databases section and make sure the user is added to the database with ALL privileges.

"Failed to connect to FTP Server" Error

This error usually appears when installing plugins or themes, not during the main installation. The simple solution is to add this code to the wp-config.php file, before the line /* That's all, stop editing! */:

define('FS_METHOD', 'direct');

This command tells WordPress to work directly through the file system and doesn't need FTP. If you still see the error, make sure the file ownership is correct (usually it should be www-data or the hosting user).

White Screen of Death

If you see a white screen after installation, a PHP error has likely occurred. To see the error, open the wp-config.php file and add this line:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

Then check the wp-content/debug.log file. The most common cause is insufficient PHP memory. To fix it, add this line to wp-config.php:

define('WP_MEMORY_LIMIT', '256M');

"Headers already sent" Error

This error usually means there's a blank space or BOM character before <?php in the wp-config.php file or theme files. Open the file with a clean editor like Notepad++, select "UTF-8 without BOM" from the Encoding menu, and save it.

After Installation: Essential Actions

After a successful installation, be sure to do the following:

  1. From the Dashboard, go to Settings → Permalinks and select the Post name structure to have SEO-friendly URLs.
  2. Activate an SSL certificate. Most hosts have a free Let's Encrypt option. After activation, update the site address in WordPress settings with https://.
  3. Change security defaults: don't create an admin username, use reputable security plugins, and don't forget regular updates.

If your host doesn't have an automatic installation tool or you prefer to have full control, this manual method is the best choice. ServerNet also provides WordPress installation in its hosting packages, but the method you read in this guide works independently of any host and increases your technical knowledge for managing your site.

Installing WordPress on hosting, once you do it, stays in your mind forever. If you encounter an error at any step that wasn't covered in this article, search for the exact error on Google — you can be almost certain someone has had the same problem before and published the solution.

ServerNet Support

ServerNet engineering & editorial team — specialists in infrastructure, networking and web hosting.

WordPress Hosting
Share:

Comments 0

No comments yet — be the first!

Leave a comment

Related service

WordPress Hosting

A purpose-built WordPress stack on LiteSpeed Enterprise and NVMe — auto-install, secure updates, staging and caching that keeps you on top of Google.