How to Install WordPress on cPanel or Localhost

install wordpress via cpanel

Learn how to install WordPress on cPanel or localhost, from creating a database to finishing the setup wizard. This guide also covers wp-config.php and fixes for common installation errors.

Last updated: · By Ryan Walsh

Installing WordPress usually takes under five minutes once your database and files are ready, according to the official WordPress developer guide on installation. The core steps are the same on a live web host with cPanel and on a local computer running XAMPP or MAMP. On a live host, you create a database, upload WordPress to your public_html folder, and finish setup in your browser. On localhost, you run those steps on your own machine, which is mainly useful for building and testing a site before it goes public.

This guide covers both routes, explains the wp-config.php file, and walks through the errors beginners hit most often.

Key Takeaways

  • The official download page recommends PHP 8.3 or later, plus MySQL 8.0 or MariaDB 10.11 or later, for self-hosted WordPress installs.
  • A standard WordPress installation usually takes under five minutes, and its first step is downloading the WordPress package from wordpress.org.
  • During a local installation, WordPress generates a wp-config.php file in the root folder using the database details you enter.
  • Local environments such as XAMPP, MAMP, DDEV, and wp-env are generally meant for development, not for a public website.

What You Need Before Installing WordPress

You need a web server that runs PHP and a MySQL-compatible database, plus a way to put the WordPress files on that server. A live site also needs a domain name and hosting, while a localhost install only needs software on your computer. The table below compares the two routes.

Requirement Live site on cPanel Localhost install
Where it runs Your web host’s server Your own computer
Domain name Required Not needed
PHP and database Set by your host; aim for PHP 8.3+ and MySQL 8.0 or MariaDB 10.11+ Bundled with XAMPP or MAMP; check versions in the control panel
File access cPanel File Manager or FTP The local htdocs folder
Best for Public websites Testing and development

What Server Versions Does WordPress Need?

The official WordPress download page recommends PHP 8.3 or later, with MySQL 8.0 or MariaDB 10.11 or later, for self-hosted installs. Most modern hosts let you choose the PHP version in cPanel, so you can set it before you install. If your host only offers older versions, consider moving to a plan that supports the recommended releases. For help comparing plans, see our guide to hosting options for WordPress websites.

Preparation Checklist

  • A hosting account with cPanel access, or a computer where you can run a local server tool
  • A domain name for a live site, pointed to your host
  • A web server such as Apache or Nginx, which most hosts provide
  • An FTP client such as FileZilla, if you do not want to use cPanel File Manager
  • A plain-text editor such as Notepad++ or Sublime Text for editing wp-config.php if needed

Installing WordPress on cPanel: Step-by-Step

To install WordPress on cPanel, create a MySQL database, upload the WordPress package to public_html, extract it, and then complete the setup wizard in your browser. Each step takes only a few minutes once your hosting account is active.

flexible customizable seo friendly platform

How Do You Create a MySQL Database in cPanel?

  1. Log in to cPanel, usually at yourdomain.com/cpanel or through your host’s dashboard login.
  2. Open MySQL Databases, or use the MySQL Database Wizard if your host provides it.
  3. Create a new database and write down its full name, since cPanel often adds your account name as a prefix.
  4. Create a database user with a strong, unique password and save the username and password.
  5. Add the user to the database and grant all privileges, then confirm the change.

Keep the database name, username, and password together somewhere safe. You will enter them in the setup wizard.

How Do You Upload WordPress Files to public_html?

Download the latest WordPress zip file from the official site, then upload it to the public_html folder of your domain. You can use cPanel File Manager or an FTP client to do this.

  1. Download the latest WordPress zip file from wordpress.org.
  2. In cPanel, open File Manager and go to public_html, or the folder for your domain if it is an add-on domain.
  3. Click Upload and select the zip file.
  4. Right-click the zip file, choose Extract, and confirm the WordPress files appear in the folder.
  5. If extraction creates a wordpress subfolder, move its contents up into public_html or install from that folder. Then delete the zip file.

How Do You Finish the Setup Wizard?

Open your domain in a browser. WordPress detects that it is not yet configured and starts the installer, which asks for database details and then for your site information.

  1. Choose your language and continue.
  2. Enter the database name, username, and password you created, plus the database host. On many cPanel hosts this is localhost, but check your host’s documentation if the connection fails.
  3. Enter your site title, an admin username, a strong admin password, and an email address you check regularly.
  4. Click Install WordPress, then log in at yourdomain.com/wp-admin.

Installing WordPress on Localhost With XAMPP or MAMP

To install WordPress on localhost, run a local server such as XAMPP or MAMP, create a database in phpMyAdmin, place the WordPress files in the server’s web folder, and open the setup page in your browser. Local installs let you test a site without a domain or hosting, but they are not meant for public visitors.

wordpress installation essentials checklist

The official development guide for WordPress lists several local environment options, including wp-env, XAMPP, MAMP, DDEV, and Bitnami’s one-click WordPress package. The guide notes that local installs are usually meant for development. XAMPP and MAMP are the most common choices for beginners on Windows and macOS.

How Do You Set Up XAMPP or MAMP?

  1. Download XAMPP or MAMP from the official website of the tool and run the installer.
  2. Open the control panel and start the Apache and MySQL modules.
  3. Open localhost in your browser to confirm the server responds. With MAMP, the default address may include a port number such as localhost:8888.

How Do You Create the Local Database and Files?

  1. Open phpMyAdmin at localhost/phpmyadmin and create a new database. Give it a clear name, such as wordpress_local, and note it.
  2. Download WordPress and extract the wordpress folder into htdocs. In XAMPP this is usually C:\xampp\htdocs, and in MAMP it is inside the MAMP htdocs folder.
  3. Open localhost/wordpress in your browser and enter the database name, plus the MySQL username and password your local tool uses.
  4. Finish the wizard by setting a site title, admin account, and password.

During this setup, WordPress uses the database details you enter to create the database tables and generate the wp-config.php file in the root folder. You rarely need to write that file by hand, as explained in the WordPress.org installation lesson.

How the wp-config.php File Works

The wp-config.php file stores your database connection details and core settings. WordPress creates it during installation, and you only need to edit it when you move a site, fix a connection error, or change an advanced setting.

The file holds the database name, username, password, and host, along with the table prefix, which defaults to wp_. It also contains authentication keys and salts, which WordPress sets during setup to protect logins and cookies. Changing the table prefix to something unique, such as wp7x_, makes automated attacks that assume the default slightly less effective. It does not replace regular updates or strong passwords.

Never share this file or leave a copy in a public folder, because it contains the credentials for your database. If you edit it, make a backup first.

Troubleshooting Common Installation Errors

Most installation failures come from database credentials, file locations, or the PHP version. Check these items in order before you delete files and start over.

  • Database connection error: Confirm the database name, username, password, and host match what you created. In cPanel, names often include your account prefix.
  • Blank page or 500 error: Check the PHP version in your host’s selector and review the error log in cPanel.
  • Setup page does not load: Confirm the WordPress files sit in public_html and not inside an extra folder.
  • Permission errors: Confirm folders and files use the standard permissions your host recommends, which are commonly 755 for folders and 644 for files.
  • Localhost page does not load: Make sure Apache and MySQL are running, and check that you are using the correct port number.

For more fixes, read this beginner guide to fixing common WordPress errors.

What to Do After Installing WordPress

After installation, log in, configure the basics, and secure your admin account before you add content. These steps protect your site and make it easier to publish.

  1. Set your permalink structure under Settings, then Permalinks, so your URLs are readable.
  2. Delete default content you do not need, and remove any themes or plugins you will not use.
  3. Create separate accounts for editors and writers instead of sharing the admin login. Learn more about managing WordPress user roles and permissions.
  4. Turn on HTTPS with a free SSL certificate by following this guide to enabling HTTPS on WordPress.
  5. Set up backups and keep WordPress, themes, and plugins updated. For broader protection, review these must-know WordPress security practices.

Frequently Asked Questions

How long does installing WordPress take?

A standard installation usually takes under five minutes, according to the official WordPress developer guide. Most of the time goes to creating the database and uploading files. A local install takes longer the first time because you also need to install and start XAMPP or MAMP.

Can I install WordPress without cPanel?

Yes. Many hosts use other dashboards, and you can upload the files through FTP or SFTP instead. The database steps are the same in principle: create a database, a user, and a password, then run the setup wizard.

Do I need a domain to install WordPress on localhost?

No. A localhost install runs on your own computer at a local address, so you do not need a domain or hosting. You need a domain only when you want the site to be reachable by the public.

Which PHP version should I use?

The official download page recommends PHP 8.3 or later for self-hosted installs. Check your version in cPanel’s PHP selector or in your local tool’s settings. Use the recommended version whenever your host or tool allows it.

Can I move a local WordPress site to a live host?

Yes, but it takes more than copying files. You need to export the database, copy the files, and update the site address and database settings for the new host. Back up both copies before you start, and test the live site before you point your domain to it.

Conclusion

Installing WordPress on cPanel or localhost comes down to three core tasks: create a database, place the files in the correct folder, and finish the setup wizard. Use cPanel for a public site and XAMPP or MAMP for testing before you launch. Once the install works, focus on backups, security, and your first content, and you will have a solid foundation for your site.

Ryan Walsh

Ryan Walsh

Ryan Walsh is the pen name under which the Start WordPress team writes and edits its guides. The focus is helping beginners build and run a WordPress site: setup, hosting, themes, plugins, security, speed and SEO, with steps checked against official documentation. Read our editorial policy (startwordpress.net/editorial-policy/) and disclaimer (startwordpress.net/disclaimer/).
wordpress terminology for beginners Previous post The Beginner’s Glossary to WordPress Terminology
wordpress pitfalls for beginners Next post 10 Common WordPress Mistakes Beginners Must Avoid