Routing problems

Hello, I’m trying to use form to post to a route, which puts the form data into a database, but I keep getting error 500 on it.

What’s wrong with this?

	"pattern" => "mc/list/add",
	"action" => function($call) {
		$db = new Database(array(
			"type"		=>	"mysql",
			"host"		=>	"",
			"database"	=>	"gsponsor",
			"user"		=>	"root",
			"password"	=>	"root"

		$subscribers = $db->table("subscribers");
		$subscriber = $subscribers->insert(array(
			"id" => "",
			"email_address" => $_POST["email"],
			"ip_signup" => "127",
			"fname" => $_POST["fname"],
			"lname" => $_POST["lname"]

		return response::json(array(
			"hh" => $subscriber
	"method" => "POST"

Are there any errors in the output or in your PHP error log? Generally HTTP 500 comes from unhandled errors.

This is what comes up in my php_error.log
Apache and MySQL says nothing

[08-Nov-2015 03:04:02 Europe/Oslo] PHP Parse error:  syntax error, unexpected 'use' (T_USE) in /Volumes/TheWiseGrey/WebServer/gsponsor. dev/site/config/config.php on line 93
[08-Nov-2015 03:04:02 Europe/Oslo] PHP Stack trace:
[08-Nov-2015 03:04:02 Europe/Oslo] PHP   1. {main}() /Volumes/TheWiseGrey/WebServer/
[08-Nov-2015 03:04:02 Europe/Oslo] PHP   2. Kirby->launch() /Volumes/TheWiseGrey/WebServer/
[08-Nov-2015 03:04:02 Europe/Oslo] PHP   3. Kirby->site() /Volumes/TheWiseGrey/WebServer/
[08-Nov-2015 03:04:02 Europe/Oslo] PHP   4. Kirby->configure() /Volumes/TheWiseGrey/WebServer/

Why are you using


Instead of


Which line is line 93 in your config.php?

$ch = curl_init();

Turns out I had to use localhost instead of, what’s strange is that I tried to used on another site, and it worked.
Guess it sometimes lives its own life

Because I’m going to use $call later on, just haven’t gotten so far yet

Ah, alright. The difference is that localhost uses the MySQL socket while uses TCP to port 3306. That’s a quite strange API decision of MySQL and I have had this issue as well and was surprised, but well. If it works it’s alright. :wink: