cPanel WordPress Install Step by Step Header

Install WordPress via cPanel Step by Step

Step 1.) Create a sub-domain for your WordPress Install.

  1. Login to cPanel
  2. Click the ‘sub-domains’ icon, beneath the ‘Domains’ heading
  3. Input a name for the sub-domain (the name must be url-friendly)
  4. Click ‘Create’ The sub-domain is done. It may take some time before the server publishes the sub-domain
  5. This video-tutorial could be helpful

Step 2.) Upload WordPress.

  1. Download a copy of WordPress from http://wordpress.org/download/
  2. Unzip the downloaded file
  3. The downloaded file contains a folder called ‘WordPress’
  4. Upload the contents of the ‘WordPress’-folder to the directory where you want WordPress to install.
  5. You can upload via ftp OR through the cPanel’s file-manager (recommended)
  6. Uploading via ftp can result in files being skipped and an incomplete copy of WordPress on the server.
  7. To Upload via the file-manager visit your cPanel home-page and click the ‘file-manager’ icon, beneath the ‘Files’-heading
  8. Navigate to the folder you want to install WordPress in
  9. Next, zip (compress, using 7-zip, winRar, or another utility) the ‘wordpress’-folder which is inside of the WordPress-ver### folder you recently downloaded and unzipped.
  10. Click the ‘upload’-icon at the top of the file-manager page. Next, browse to the zipped wordpress-folder and upload the zipped wordpress-folder to the directory.
  11. Once the upload is complete, click the ‘Back to’-link at the bottom-center of the page to navigate back to the directory you are working in.
  12. Now the zipped wordpress-folder can be seen in the directory it was uploaded to.
  13. Click the wordpress.zip file to select it and then click the ‘Extract’-icon (second from the right on the top)
  14. There’s no need to change anything on the dialogue that pops-up, just click ‘Extract’
  15. You will be returned to the directory you’re working in.
  16. Click the ‘Reload’-icon to refresh your view of the current directory. (It’s smaller than the other icons, just beneath them and slightly to the right)
  17. You should now see a folder named wordpress & a zip-file
  18. Next, select the wordpress.zip file and click the red delete-icon to delete it.
  19. The next step is to move wordpress from inside the wordpress folder we just created to the root of our sub-domain, where it will run.
  20. Double-click the wordpress folder to enter it.
  21. Click once on the top-folder, hold down the shift-key on your keyboard and click once on the bottom folder to select all of the files.
  22. Next, look to the left of the screen and notice the file-tree. Open the public_html directory on the file-tree, and then then drag & drop the wordpress-files you have selected in to the desired folder.
  23. Delete the now-empty wordpress folder (and wordpress.zip if you didn’t earlier)

Great! We now have all of the files we need to run wordpress in the correct folder. We can be sure that they are all there because we uploaded a zipped folder, rather than uploading the files one at a time through ftp. Uploading the zipped-folder was also much quicker than uploading the files one by on through ftp.

You will notice that we jump around a lot over the course of a WordPress installation. It can make life simpler to have multiple browser tabs open at once when installing WordPress via cPanel.

Step 3.) Create and Connect a Database to WordPress

The next step is to create a database for WordPress to store information in, and a user for WordPress to access the database through. To make life simpler we will fill out the wp-config file (which connects WordPress to the database) as we set up the database, and database-user.

  1. Using the file-manager, in the directory where the WordPress-files are, look for a file called ‘wp-config-sample.php’.
  2. Right-click on wp-config-sample.php and rename it to: ‘wp-config.php’
  3. Click wp-config.php to select it and then click the ‘Code Editor’-icon
  4. Don’t change anything in the pop-up, just click ‘Edit’ and the browser will take you to a screen where you can edit the contents of the file.
  5. Leave this tab open.

Next we have two options. Do we want to install WordPress to it’s own database, or do we want to install WordPress to an existing database.

If we install WordPress to an existing database, we must give each row in this installation of WordPress’ tables a prefix to differentiate it from another installations tables.

If we are using an exclusive-database for this installation we can leave out the table prefix entirely.

Now let’s set-up our database:

  1. Visit your cPanel home-page
  2. Click the ‘MySQL Databases’ icon, beneath the ‘Databases’ heading
  3. On the following page, enter a name for the new database under the ‘Creat new database’ heading… This name is often automatically prefixed with your hosting-account name.
  4. Click the ‘Create’-button and then click the ‘Go Back’-button on the next page.
  5. Next to create a new user scroll down to the ‘MySQL Users’-heading, create a new user and give that user a password.
  6. Click the ‘Create User’-button and then click the ‘Go Back’-button on the next page.
  7. Finally, we connect the user to the database.
  8. Scroll down to the ‘Add User To Database’-heading and select a database with the bottom drop-down menu and a user to link to that database with the top-menu. Then click the ‘Add’-button
  9. On the next page check the ‘ALL PRIVELEDGES’ box, then click the ‘Make Changes’-button

Connect WordPress to the database

We now have a new database to store our WordPress-install’s data and a user for WordPress to login to that database with and make changes.

Next we will move back to the wp-config.php file and configure it with the database-name, user-name, password, and a couple other options.

Lines 19-28 are the lines where we give WordPress the information to login to the database as the user we just created.


// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Copy/paste the database-name, user-name, and password to the relevant fields.

Remember that your database-name and user-name were given prefixes when they were created (servers do this to ensure that IF everyone called their database-user ‘admin’ they would be prefixed to differentiate them)

If you login to your account as ‘myusername’ the database-prefix is often ‘myusername’

If we had a database called ‘myusername_wpdata’, a user called ‘myusername_wpuser’, and a password of ‘awesomepassword’ we would configure our wp-config.php likeso:


// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'myusername_wpdata');

/** MySQL database username */
define('DB_USER', 'myusername_wpuser');

/** MySQL database password */
define('DB_PASSWORD', 'awesomepassword');

/** MySQL hostname */
define('DB_HOST', 'localhost');

You won’t have to change DB_HOST to anything but localhost unless you have your database hosted on a different server than your wordpress installation.

Next we will set out SALT-keys. These are random strings that are used to help encrypt ( or lightly scramble to enhance the security of ) the web-site’s data.

Visit this link: https://api.wordpress.org/secret-key/1.1/salt/

Copy/paste the code the page generates and change this:


define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');

to something like this:


define('AUTH_KEY', '+GT0c0J~eh%yZ-%Ya6n3z*+_B,-jNMG|-l-&-2a` La3e%m^|J:X:{]a!wXOSsG_0LQES!rHiJZHf(qwQ');
define('LOGGED_IN_KEY', '~x l3aw2k5)N#+7)ayAn)38U(=#+bwyYeiyM=%&gQ%Sd)r.V,[$b)>>FwlB@E@Z:');
define('NONCE_KEY', '{.H8zs]-C+:!uku@wrc09L;ltvn8uS&DXOi,D7o;q+gnA/7EmYCU4_%V=35,)I{w');
define('AUTH_SALT', 'ji,[i9Ort#nZ+Kv+|X&[gw_Y*5768%!Tbd>*60JY7+*8ULAWSqSl1#|');
define('SECURE_AUTH_SALT', '$KKYt^CTX-9&r25w])jmWf(+#F+tYim$chL+km[!9-2M|:K>~AD5U|jZjKR!pFV{WRhc!{4D~%Z*Q9;');
define('NONCE_SALT', 'ewlEB9u,)|}q}Ij[8u3A0i{NPiLVmfzEy=l{]-=q{oL(b|r#ChBp!pRZ(O$%#RKM');

Great! We can now visit: http://oursubdomain.oursite.com/
and we will be prompted to give our new site a name, and set up an admin-user for it. That’s it!

I mentioned earlier that we can install WordPress along side other data, even another WordPress-installation in the same database. The steps for configuring our wp-config.php would be the same, except for one more step:

Setting a WordPress Database Prefix

When we have two copies of WordPress living in the same database, we need to make sure they can tell each other apart, to do that we give them a prefix, or unique-ID.

On line 62 of wp-config.php you can set the table-prefix.

In the following example our prefix is: myprefix_


$table_prefix = 'myprefix_';

(do this prior to http://oursubdomain.oursite.com/ – Visiting the url where you have installed WordPress is what triggers WordPress to set-itself up in the database.)

Make sure that each installation of WordPress in the database has it’s own unique prefix.

Configure .htaccess if using Sub-Folders

The following is only for sub-folders and doesn’t need to be done when installing on sub-domains.

WordPress needs to tweak the .htaccess-file a bit to run correctly. .htaccess is a server file which is truly volatile so watch your step when you hit compile. ya dig? .htaccess stands for “hyper-text access” and can do things like redirect urls, prevent people from visiting certain directories and even password-protect files and directories… It can also redirect your homepage to the homepage… that doesn’t end well. Really, it doesn’t end at all.

Typically WordPress likes it to have this little snippet in it:


# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

But if you are hosting WordPress in a sub-folder ( Sub-Folder, not sub-domain… when you create a sub-domain the server will resolve this for you ), the snippet needs to include that sub-folder’s path…


# BEGIN WordPress

RewriteEngine On
RewriteBase /the_sub_folder/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /the_sub_folder/index.php [L]

# END WordPress

Finally: If you’re hosting multiple WordPress installations in a folder – Don’t put a WordPress installation at the root – Having other WordPress installations inside of it – try to work things so that each install gets it’s own folder. Why? There’s too many things that could go wrong and I don’t know 95% of them. WordPress is a piece of computer software – as a general rule of thumb it’s not good to run programs inside of themselves.


Posted

in

by

Tags: