I installed jobberBase using automatic installation (softaculous) on arvixe. As this was all automatic installation chances of any errors are rare. Still I did double checked that database got created fine; also the configuration looked fined.
I saw this errors on many other threads too but couldnt find a solution anywhere ; so looks like its a common installation problem. Most probably the php are not able to connect to DB ! Any help would be highly appreciated.
Warning: mysqli::mysqli() expects parameter 5 to be long, string given in /home/muskete3/public_html/jobber/_includes/class.Db.php on line 20
Warning: mysqli::query() [mysqli.query]: Couldn't fetch Db in /home/muskete3/public_html/jobber/_includes/class.Db.php on line 72
Warning: mysqli_error() [function.mysqli-error]: Couldn't fetch Db in /home/muskete3/public_html/jobber/_includes/class.Db.php on line 73
Warning: mysqli::query() [mysqli.query]: Couldn't fetch Db in /home/muskete3/public_html/jobber/_includes/class.Db.php on line 31
Warning: mysqli_error() [function.mysqli-error]: Couldn't fetch Db in /home/muskete3/public_html/jobber/_includes/class.Db.php on line 32
Fatal error: Call to a member function fetch_assoc() on a non-object in /home/muskete3/public_html/jobber/_includes/class.JobberSettings.php on line 23
My configuration file is :
<?php
/**
* Define environments
*
*/
// local (http://localhost/jobberbase/public)
$__instances['local'] = array(
// should be a unique part of the url (or the entire url if you wish)
'prefix' => 'www.jobs41.net',
// mysql credentials
'db_host' => 'localhost',
'db_port' => 3306,
'db_user' => '***',
'db_password' => '***',
'db_name' => '***',
'db_prefix' => '',
// your site's full url
'app_url' => 'http://www.jobs41.net/jobber/',
// error reporting
'ini_error_reporting' => E_ALL,
'ini_display_errors' => 'On',
// environment setting 1 (use 'local' for localhost/testing OR 'online' for live, production environment)
'location' => 'local',
// environment setting 2 (use 'dev' together with 'local' in the previous setting OR 'prod' with 'online')
'environment' => 'dev',
//'apache_mod_rewrite', 'iis_url_rewrite' -microsoft URL Rewrite module, 'iis_isapi_rewrite'
'rewrite_mode' => 'apache_mod_rewrite'
);
// live (http://www.yourjobberbasedomain.com)
$__instances['live'] = array(
'prefix' => 'www.jobs41.net',
'db_host' => 'localhost',
'db_port' => 3306,
'db_user' => 'muskete3_jobb563',
'db_password' => '6Sn82hxv7P',
'db_name' => 'muskete3_jobb563',
'db_prefix' => '',
'app_url' => 'http://www.jobs41.net/jobber/',
'ini_error_reporting' => E_ALL,
'ini_display_errors' => 'Off',
'location' => 'online',
'environment' => 'prod',
'rewrite_mode' => 'apache_mod_rewrite'
);
Previously I had installed it not as root directory; hence it was installed inside public_html/job.. Now when i installed it again in root directory it worked fine.
Related
I have a YII 1 application. And I try to connect with the Azure database.
I can connect with the azure database if I disable the option: Enforce SSL connection
But of course I want to enable this option.
But if I enable this option. I get this error:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [9002] SSL connection is required. Please specify SSL options and retry.
CWebUser.php(146)
134
135 /**
136 * PHP magic method.
137 * This method is overridden so that persistent states can be accessed like properties.
138 * #param string $name property name
139 * #return mixed property value
140 */
141 public function __get($name)
142 {
143 if($this->hasState($name))
144 return $this->getState($name);
145 else
146 return parent::__get($name);
147 }
148
149 /**
150 * PHP magic method.
151 * This method is overridden so that persistent states can be set like properties.
152 * #param string $name property name
153 * #param mixed $value property value
154 * #throws CException
155 */
156 public function __set($name,$value)
157 {
158 if($this->hasState($name))
And my main.php in looks like this:
'db'=> [
'pdoClass' => 'NestedPDO',
'connectionString' => 'mysql:host=host_name;dbname=db_name',
'emulatePrepare' => true,
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
'enableProfiling'=>true,
],
'cache'=>[
'class'=>'system.caching.CDbCache',
],
So my question is: what is missing in this part of configuration?
Thank you
if I try it like this:
'db'=> [
'pdoClass' => 'NestedPDO',
'connectionString' => 'mysql:host=host_name;dbname=db_name',
'emulatePrepare' => true,
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
'enableProfiling'=>true,
'attributes' =>[
PDO::MYSQL_ATTR_SSL_CA => 'path ssl'
]
I get this error:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] (trying to connect via (null))
and In mysql workbrench if I test the ssl certificat I get a successful response.
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] (trying to connect via (null))
As suggested by toffler, adding comment as a community wiki answer to help community members who might face a similar issue.
The error got resolved after adding PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false as per How to use SSL in PHP Data Objects (PDO) mysql
I'm having a try at connecting to a MSSQL DB using PHP on a Linux system.
Using tsql -S <dbConfig> or tsql -H <dbHost> successfully connects to the database (with user credentials of course). However, using the same host and config within PDO returns a failed to connect to host adapter error.
The issue seems to be living somewhere between PHP PDO and, I'm assuming freetds.
The debug looks like this:
PDOException in Connector.php line 55:
SQLSTATE[01002] Adaptive Server connection failed (MYHOST.database.windows.net) (severity 9)
in Connector.php line 55
at PDO->__construct('dblib:host=MYHOST.database.windows.net;dbname=RecipeDB;charset=utf8', 'MYUSER#MYHOST', 'MYPASSWORD', array('0', '2', '0', false)) in Connector.php line 55
at Connector->createConnection('dblib:host=MYHOST.database.windows.net;dbname=RecipeDB;charset=utf8', array('driver' => 'sqlsrv', 'host' => 'MYHOST.database.windows.net', 'database' => 'RecipeDB', 'username' => 'MYUSER#MYHOST', 'password' => 'MYPASSWORD', 'charset' => 'utf8', 'prefix' => '', 'name' => 'remoteRecipes'), array('0', '2', '0', false)) in SqlServerConnector.php line 32
at SqlServerConnector->connect(array('driver' => 'sqlsrv', 'host' => 'MYHOST.database.windows.net', 'database' => 'RecipeDB', 'username' => 'MYUSER#MYHOST', 'password' => 'MYPASSWORD', 'charset' => 'utf8', 'prefix' => '', 'name' => 'remoteRecipes')) in ConnectionFactory.php line 61
at ConnectionFactory->Illuminate\Database\Connectors\{closure}()
It seems I'd managed to remove the line containing [global] from my /etc/freetds.conf file. Once I replaced it PDO was able to make a call to the database.
Below is what it looks like for me:
[global]
# TDS protocol version
; tds version = 4.2
tds version = 8.0
client charset = UTF-8
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
dump file = /tmp/freetds.log
debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
[testConnection]
host = MYHOST.database.windows.net
port = 1433
tds version = 8.0
I have a project done with Silex, and I was using herrera-io/silex-pdo as the PDO provider, but I faced random crashes with socket errors (I connect to the DB via socket), since that lib is abandoned, I changed to csanquer/pdo-service-provider, and it works just fine on my localhost server, but when I deploy to remote, I get the following error:
PHP Fatal error: Class 'Csanquer\Silex\PdoServiceProvider\Provider\PdoServiceProvider' not found in /app/web/index.php on line 52
Here is the code around the line 52:
use Csanquer\Silex\PdoServiceProvider\Provider\PdoServiceProvider;
$app->register(
// you can customize services and options prefix with the provider first argument (default = 'pdo')
new PdoServiceProvider('pdo'), // Line 52
array(
'pdo.server' => array(
// PDO driver to use among : mysql, pgsql , oracle, mssql, sqlite, dblib
'driver' => 'mysql',
'host' => 'unix_socket=/app/mysqld.sock',
'dbname' => 'db_beta',
'port' => 3306,
'user' => 'user',
'password' => 'pass',
),
// optional PDO attributes used in PDO constructor 4th argument driver_options
// some PDO attributes can be used only as PDO driver_options
// see http://www.php.net/manual/fr/pdo.construct.php
'pdo.options' => array(
\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"
),
// optional PDO attributes set with PDO::setAttribute
// see http://www.php.net/manual/fr/pdo.setattribute.php
'pdo.attributes' => array(
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
),
)
);
Thanks in advance for any help, or any clue of what may be going wrong!
Turns out the problem was with the use instructions. To fix, simply change:
use Csanquer\Silex\PdoServiceProvider\Provider\PdoServiceProvider;
To:
use Csanquer\Silex\PdoServiceProvider\Provider\PDOServiceProvider;
And:
new PdoServiceProvider('pdo') To: new PDOServiceProvider('pdo')
Now it works!
Renaming database.php.default to database.phpin \app\Config\ in CAKEPHP gives Error
I have installed a fresh copy of CAKEPHP 2.1.3 on XAMPP with Windows 7 and i have got an error
Warning (2): include_once(D:\xampp\htdocs\cakephp\example\app\Config\database.php) [function.include-once]: failed to open stream: No such file or directory [CORE\Cake\Model\ConnectionManager.php, line 68]
Warning (2): include_once() [function.include]: Failed opening 'D:\xampp\htdocs\cakephp\example\app\Config\database.php' for inclusion (include_path='D:\xampp\htdocs\cakephp\example\lib;.;D:\xampp\php\PEAR') [CORE\Cake\Model\ConnectionManager.php, line 68]
When i look into for database.php file in \app\config\ its not present
Instead, i found database.php.default in \app\Config\ and \lib\Cake\Console\Templates\skel\Config
And when i rename the database.php.default to database.php, it still gives me an error.
How do i need to connect to database and next procedure to go ahead.
Move config file from \lib\Cake\Console\Templates\skel\Config to D:\xampp\htdocs\cakephp\example\app\Config\
Or create new one with contents:
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'username',
'password' => 'password',
'database' => 'databas name',
'prefix' => '',
//'encoding' => 'utf8',
);
}
Upgraded a (dev) Cake PHP site and had to change database drivers from ADO to SQL Server's own driver as ADO is no longer supported in Cake 1.3, I . The new SQL Server driver is installed in PHP, shows in PHPinfo() and should work, but when I try to load a page using the database, I get this error:
Warning (2): sqlsrv_query() expects parameter 1 to be resource, boolean given
[APP\plugins\datasources\models\datasources\dbo\dbo_sqlsrv.php, line 184]
Warning (512): SQL Error: An invalid parameter was passed to sqlsrv_query.
[CORE\cake\libs\model\datasources\dbo_source.php, line 684]
Query: SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
What appears to be happening is my connection isn't established in the dbo_sqlsrv.php driver; a "$this->connection" variable is supposed to be the connection resource then passed to sqlsrv_query() and it's apparently a bool which is wrong (I tried to Echo the variable and it displays nothing).
This is where the connection SHOULD be set:
sqlsrv_connect($this->config['host'] . $port, $params)
Printing the variables that were passed in gives me this:
SRV, 1433 Array ( [Database] => DB [CharacterSet] => char
[MultipleActiveResultSets] => [UID] => sa [PWD] => password )
Each of those parameters is correct, is there a specific way I should format or change my database configuration array for this driver or is there something I am missing?
This error was due to outdated SQL Server drivers. Installing the latest from below allows a SQL Server connection:
http://www.microsoft.com/download/en/details.aspx?id=20098
I think there is some issue with your connection. PHP can't establish connection with sql Server.
var $default = array(
'driver' => 'sqlsrv',
'persistent' => false,
'host' => 'Myhome-PC\SQLEXPRESS', // or ip-address(192.168.1.13)
'login' => 'username',
'password' => 'password',
'database' => 'db',
'prefix' => 'tbl',
'port' => NULL,
'returnDatesAsStrings' => True
);
I think the Connection should be this
Here is the sqlsrv_dbo which I used.
And your $param should be something like this
$connectionInfo = array("UID" => $config['login'],
"PWD" => $config['password'],
"Database" => $config['database'],
'MultipleActiveResultSets' => 1,
'ConnectionPooling' => 0
);
if(isset($config['ReturnDatesAsStrings'])){
$connectionInfo['ReturnDatesAsStrings'] = $config['ReturnDatesAsStrings'];
}
$this->connection = sqlsrv_connect($config['host'] . $port, $connectionInfo);