Apache – WordPress, MySQL and MongoDB

WordPress

It is very important that the WordPress page is set up with the correct hostname. If it is not then many of the page links will break. If this has happened to you and you’re getting Apache 404 errors then you need to see Section C.

The WordPress site is the default site which is seen when you go to your machine in a web browser at:

datatoolkit.org.uk

It is hosted in the /var/www/wordpress folder of the machine. The WordPress site contains all of the docu- mentation for this project as well as information about the project and how to spin off your own data project. It is essentially a website.

Admin

As with any website you can edit the pages. This is made very easy for you as we have used the WordPress backend. This allows for easy theme changes and allows any non-programmer generate a nice looking website. You can access the WordPress control panel at:

datatoolkit.org.uk/wp-admin

As with all other sections of the machine the Username/Password are: admin/(Password Redacted. Contact datatoolkit@kwmc.org.uk for password)

Once in you are presented with this interface:

wordpress

From here it is pretty self explanatory. If you need help documentation can be found at:

http://codex.wordpress.org/Getting_Started_with_WordPress

MySQL — phpmyadmin

f you decide you wish to do any Web development using a MySQL database. We have provided one on the machine. It is actually powering the WordPress website but if you decide you wish to use the database we have set up some useful guides on basic PHP and MySQL code in the 4 Step Data Guide:

http://datatoolkit.org.uk/4-step-data-diy/

If you have to generate a database to use you can do that easily from within the phpmyadmin interface located here:

http://datatoolkit.org.uk/phpmyadmin

  • Username — root
  • Password — (Password Redacted. Contact KWMC For password)

You can add a user and a database simply by clicking “Users”:

phpmyadmin

Then “Add User”

phpmyadmin-users

Once in the “Add User” dialogue we need to fill in a few fields:

  • Username — databasename
  • Host — localhost
  • Password — your chosen password
  • Checkbox which says: “Create database with same name and grant all privileges” — ticked

phpmyadmin-adduser

Press “Go” to save your changes.
If you select “Databases” in the top now you will be able to see your new MySQL database.

All of your code will need to go in the /var/www/wordpress folder and be owned by the user www-data to be accessible via the web.

Curating Activism Questionnaire — MongoDB

The MongoDB portal is a basic proof of concept of PHP integration with MongoDB. You can access it here:

http://datatoolkit.org.uk:5001

Or download the source code here:

http://datatoolkit.org.uk:5001/sourceCode.zip

This code is a simple survey with a database link. This works in a similar way to the 4 Step Data DIY ex- ample however uses an extremely different type of database. The MySQL database is what we call a traditional database. It allows for a user to store data in tables (much like MS Access) and link those tables together. Mon- goDB in comparison is called a NoSQL database and as such it stores all the information it gets as objects. This allows for a much more flexible way of retrieving the data. The benefits of NoSQL are well documented here:

http://www.mongodb.com/nosql-explained

The best way to get started with this code is to use it on this machine image which has been pre-configured to work with the PHP ↔ MongoDB plugin and change the source code. You can download the full, original source code from the site so there is no problem with breaking the site as long as you keep sourceCode.zip available on the server!

Accessing MongoDB via command line

You will need to be logged into the machine using the command line. (For info see Section 4.1) From the command line type:

That’s it, we’re connected to the MongoDB process. To see available databases type:

The KWMC MongoDB survey code uses the kwmc database. To connect to this database type:

To show the current collections in the database type:

To show all the database in the surveyresponses collection type:

MongoDB has been designed to be pretty user friendly. It is a really nice database system to use so do have a go! More information can be found in the MongoDB getting started guide here:

http://docs.mongodb.org/manual/tutorial/getting-started/