Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/frameworks/frameworks_wordpress.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Getting Started with Wordpress
# Getting Started with WordPress

Wordpress was made to be simple and Wordpress on Cloud9 is no different. Here are some key docs to getting started with Wordpress.
WordPress was made to be simple and WordPress on Cloud9 is no different. Here are some key docs to getting started with WordPress.
### Run & preview your WordPress site

- [Running WordPress sites](https://docs.c9.io/running_wordpress_on_cloud9.html)
- [Running WordPress sites](https://docs.c9.io/running_WordPress_on_cloud9.html)
- [Preview your site](https://docs.c9.io/run_an_application.html#pre-view-your-application)

### Build & access your database
Expand Down
90 changes: 85 additions & 5 deletions src/persistence/setting_up_mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $ mysql-ctl stop
$ mysql-ctl cli
```

You can then connect to the database with following parameters:
After having started (and with that created) the database, you can connect to it using the following parameters:
<div markdown="1">
<table class="table table-striped table-bordered">
<thead>
Expand All @@ -40,7 +40,7 @@ You can then connect to the database with following parameters:
<tr>
<td>`Hostname`</td>
<td>`$IP`</td>
<td>The same local IP as the application you run on Cloud9</td>
<td>The environment variable 'IP' (type in a terminal: echo $IP)</td>
</tr>
<tr>
<td>`Port`</td>
Expand All @@ -50,12 +50,12 @@ You can then connect to the database with following parameters:
<tr>
<td>`User`</td>
<td>`$C9_USER`</td>
<td>Your Cloud9 user name</td>
<td>Your Cloud9 user name (again an environment variable)</td>
</tr>
<tr>
<td>`Password`</td>
<td>-</td>
<td>No password since you can only access the DB from within the workspace</td>
<td>`<empty>`</td>
<td>No password (empty string); access is restricted to the the workspace</td>
</tr>
<tr>
<td>`Database`</td>
Expand All @@ -80,6 +80,86 @@ You are now in the MySQL environment and can start the import:
To verify that everything got imported run:

mysql> show tables;

Some useful CLI commands (please note the semicolon at the end of most of them):
<div markdown="1">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Command</td>
<th>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>`help`</td>
<td>`list all mysql commands`</td>
</tr>
<tr>
<td>`show databases;`</td>
<td>`list the available databases`</td>
</tr>
<tr>
<td>`use c9`</td>
<td>`select/use database c9`</td>
</tr>
<tr>
<td>`show tables;`</td>
<td>`list the tables of the current database`</td>
</tr>
<tr>
<td>`exit`</td>
<td>`close the mysql command line tool`</td>
</tr>
<tr>
<td>`select * from mysql.user;`</td>
<td>`show all records/columns from system table user`</td>
</tr>
</tbody>
</table>
</div>

## Connecting from PHP

So now you know how to create a database, start the db server, access it via a
command line tool.. It is time for the real deal: accessing it from your code.

In this example we will connect from PHP:

1. Create a new file, call it `connect.php`

2. Copy/paste the following code in there and save the file:
```bash
<?php
// A simple PHP script demonstrating how to connect to MySQL.
// Press the 'Run' button on the top to start the web server,
// then click the URL that is emitted to the Output tab of the console.

$servername = getenv('IP');
$username = getenv('C9_USER');
$password = "";
$database = "c9";
$dbport = 3306;

// Create connection
$db = new mysqli($servername, $username, $password, $database, $dbport);

// Check connection
if ($db->connect_error) {
die("Connection failed: " . $db->connect_error);
}
echo "Connected successfully (".$db->host_info.")";
?>
```

3. Run the code by a right-click on the file tab 'connect.php', select 'run this file'

4. The output pane shows 'Starting Apache httpd...'

5. Click the link that is displayed after that

6. A preview pane will open, showing 'Connected successfully (0.0.0.0 via TCP/IP)'.


Note:
MySQL socket file can be found in ~/lib/mysql/socket/mysql.sock
Expand Down
2 changes: 1 addition & 1 deletion src/running_and_debugging/common_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If any relevant process is running you will get a list looking like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apache2 699 ubuntu 4u IPv6 83213152 0t0 TCP *:http-alt (LISTEN)

You now can kill that proccess. Make sure you replace PID with the ID of the process.
You now can kill that process. Make sure you replace PID with the ID of the process.

// Kill the process
kill -9 PID
Expand Down
2 changes: 1 addition & 1 deletion src/running_and_debugging/running_wordpress_on_cloud9.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
WordPress is web software you can use to create websites or blogs.
You can develop and host WordPress websites entirely on Cloud9 IDE

### Creating a wordpress workspace
### Creating a WordPress workspace

Create a WordPress workspace from the WordPress template on your Cloud9 dashboard

Expand Down