Reputation: 23
How to configure connection setting for sqlite database in Openshift?
Below code is my connection setup in database.php:
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Sqlite',
'persistent' => false,
'database' => get_env('OPENSHIFT_DATA_DIR').'/database.sqlite',
'prefix' => ''
);
}
I have placed my sqlite db in path: "/var/lib/openshift/~/app-root/data"
When i access the website i receive the following error:
Parse error: syntax error, unexpected '(', expecting ')' in /var/lib/openshift/~/app-root/runtime/repo/app/Config/database.php on line 65
line 65: 'database' => get_env('OPENSHIFT_DATA_DIR').'/database.sqlite',
Upvotes: 0
Views: 243
Reputation: 947
In PHP you can not use a function when declaring a class property.
If you must use that function you can write:
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Sqlite',
'persistent' => false,
'prefix' => ''
);
function __construct() {
$this->default['database'] = get_env('OPENSHIFT_DATA_DIR').'/database.sqlite';
}
}
Upvotes: 2