Touch the firehose of ds106, the most recent flow of content from all of the blogs syndicated into ds106. As of right now, there have been 92468 posts brought in here going back to December 2010. If you want to be part of the flow, first learn more about ds106. Then, if you are truly ready and up to the task of creating web art, sign up and start doing it.

Building a site without WordPress part 2: Granting permissions and uploading files

Posted by
|

The first part of this tutorial is located here.  At this point, you should have a new database with a user that has been added to it.

The next part of the tutorial gets a bit more computer-science oriented.  If you haven’t worked directly with SQL this isn’t the best tutorial for you.  It is intended for people who have some coding experience but don’t know how to make a site go live (beyond localhost on their own computer).

I will now request that you return to the cPanel homepage.  The next step is to set up a website and make it so that you can access your database.  To do so, begin by clicking on “subdomains.”  Here I circled it in red:

subdomains

Once there, create a new subdomain.  This will be the location of your new site.  I’m pretty sure I left “document root” blank and let it fill something in for me.  Once you’ve created your subdomain, it should appear in a list at the bottom of the page.  Click on the link to its document root.  Mine looks like this:

root

This is where the files that make up your site are going to be.  In the upper left, there is a tool that says “new file.” Click on it.  Name the file “db_connect.php.” It should now appear in your list of files.  Right click on it and select code editor.  This is where you get to grant yourself permission to access the database.  You’re going to want to type in the following code:

<?php
session_start();
$db = mysql_connect(‘localhost’, ‘username’, ‘password’)
or die (mysql_error());
mysql_select_db(“databasename”) or die(mysql_error());
?>

Instead of username, password, and databasename, enter the information for the user and database you created in the last tutorial.  You don’t have to include “session_start();” but it’s a good idea.  You’ll want to put

<?php include(‘db_connect.php’); ?>

at the top of every file you create, so starting a new session is something you’d want to do anyway.  Save the file.  Now you should be able to use MySQL queries in your files that include db_connect.php.  If you want to manually manipulate your database instead of using queries in your code, you can go to phpMyAdmin from the cPanel homepage:

phpmyadmin

One last note: The default homepage for your site is called index.  I think mine was in there as index.php.  That’s the best place to start.  Good luck!

Add a comment

ds106 in[SPIRE]