Error in CDbException when hosting yii app on godaddy - php

I having one yii app hosted on godaddy windows hosting server,
All db config is ok but i am facing one error as **CDbException
CDbConnection failed to open the DB connection.**
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=my_db_name',
'emulatePrepare' => true,
'username' => 'myusername',
'password' => 'mypassword',
'charset' => 'utf8',
'tablePrefix' => 'tbl_'
),
all host name dbname username and pasword is correct then also i am facing with this error.
If someone have all ready solved this problem of hosting yii app on godaddy windows server please help me....
Thank you in advance..

Does the error message continue with "could not find driver?" Godaddy has PHP's PDO extension disabled on its Windows boxes (see here). Fastest solution were to change your hosting plan to Linux.

Related

Can't connect to database with laravel 5

I'm trying to connect to my mssql database with laravel 5 but it's not working. I've tried to connect with different mssql databases so it's not a firewall issue. Also my credentials are correct. I found on google that you need SQL Server Native Client 11.0 and I've already installed that.
This is my connection array in config/database.php:
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('nvt'),
'database' => env('nvt'),
'username' => env('nvt'),
'password' => env('nvt'),
'charset' => 'utf8',
'prefix' => '',
],
And I've set the default to "sqlsrv" :
'default' => env('sqlsrv','sqlsrv'),
But when I'm trying to create a table I receive the error:
PDOException in Connector.php line 50: could not find driver
What could be wrong???
EDIT:
I've installed pdo for sqlsrv from here:
http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx
And I added it to my php.ini file:
extension=\Installaties\php_pdo_sqlsrv_53_nts.dll
But stil I receive the error?
Try to remove the eve() method, i mean use the following method
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => 'nvt',
'database' => 'nvt',
'username' => 'nvt',
'password' => 'nvt',
'charset' => 'utf8',
'prefix' => '',
],
I ran into a similar issue. Try putting in the server info directly rather than using env. If it works, then you know Laravel is having an issue reading the .env file.
I encountered your problem the last time I tried my connection in sqlsrv. I am using xampp. Try putting yung php_pdo_sqlsrv_53_nts.dll in the ext folder, replace extension=\Installaties\php_pdo_sqlsrv_53_nts.dll with extension=php_pdo_sqlsrv_53_nts.dll and try installing odbc 11 on your computer. It worked for me but not sure why. (not an expert) if it worked good to help a fellow person and if not, sorry for the trouble. Thank you for the time reading.
You may try any of the following solutions
Check that you have entered the right connection parameters. Test by connecting to the DB with a client tool.
Make sure you have the right version of sqlsrv configured for your machine. Check the PHP logs to be sure your web server was able to load the extension correctly.
Set the port to null in your env file
As a tip, I won't advise anyone to set the connection parameters anywhere but in the .env (Setting it in config/database is a security risk).

Drupal install on different hosting

I installed my drupal page on a hosting and i have a domain but this domain is hosted by an another company. Is there a small fix to connect the host and domain ?
Inside drupal settings.php by default is this, yes i already have the user sql everything but dont know how to connect the domain and hosting... maybe i need to add the Ip of the hosting ? but where? :
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'databasename',
'username' => 'username',
'password' => 'password',
'host' => 'localhost',
'prefix' => 'main_',
'collation' => 'utf8_general_ci', );
Thank you for the help!
Connecting a domain and hosting has nothing to do with Drupal. That bit of script in the settings is only telling Drupal where the MySQL server is. localhost meaning that the MySQL server is on the same server as that file (the same server as Drupal).
You need to login to your domain registrar and enter the nameservers for your host.
The best and easiest way is to change your current DNS settings for your domain and point them to the server where your drupal website is hosted.
another possibility is to go to your domain registry and change the authoritative NS hosts for your domain to the ones provided by your host, so you can manage your DNS settings via your webhost and connect your domain to your server.
your webhost support should help you regarding this if you're still not sure how to do it.

SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9) Laravel

I'm getting this error when trying to connect to an SQL Server DB from Laravel 4.2.
Here's my DB config:
'connections' => array(
'sqlsrv' => array(
'driver' => 'sqlsrv',
'host' => 'example.noip.me',
'database' => 'db',
'username' => 'sa',
'password' => 'pass',
'prefix' => '',
),
),
//...
It works perfectly in my home computer, but not in production. This project is in a hosting service, so I can't change much of the config (can still use ini_set though).
I tried adding the port to the server address but it didn't work.
Edit: I forgot to mention that the hosting and the database server are on different computers, so it could be a security configuration problem.
I contacted tech support and it turned out to be a matter of configuration in the hosting server (Remote Database Access Hosts, which I thought was for MySQL only).

Access Remote SQL database [2002]

Okay so i am trying to connect to my remote SQL database.
i am using the following settings:
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => '10.246.16.153:3306',
'login' => '*******',
'password' => '*******',
'database' => 'udlejnings_pris',
'prefix' => '',
//'encoding' => 'utf8',
);
My Database settings are the following:
Database server
Server: 10.246.16.153 via TCP/IP
Software: MySQL
Software version: 5.1.66-0+squeeze1 - (Debian)
Protocol version: 10
Server charset: UTF-8 Unicode (utf8)
Now when im trying to access this server i get the following error:
2013-10-12 16:27:28 Error: [MissingConnectionException] Database connection "Mysql" is missing, or could not be created.
Exception Attributes: array (
'class' => 'Mysql',
'message' => 'SQLSTATE[HY000] [2002]
',
'enabled' => true,
)
So what am i doing wrong?
Many hosted MySQL instances don't allow clients to connect remotely by default. You may need to add your IP address into some form of Remote MySQL option if your database host provides it. For example, if the server with the database on it uses cPanel, there is a 'Remote MySQL' option on there which may resolve your issue. Alternatively, you could execute the 'GRANT' SQL command to allow your user account access remotely as described in this answer.
If you still have issues, a firewall may be blocking the connection locally too.
Maybe you need to enable mysql remote access on the server that you are connecting to. By default it is disabled.
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

Database not connecting with server on different host CakePHP version 2.0.0-dev

I am facing problem while connecting cake php version-2.0.0-dev application on server. When I connect with localhost database, it works fine on server, but if I try to connect it with the database of the different server which is being hosted by another host, it gives following error:
Fatal error: Call to a member function getAttribute() on a non-object in
/home/dev.ukssmain/public_html/stock_system_ukrs/cake/libs/model/datasources/dbo/dbo_mysql.php
on line 259**
My configuration in database.php file is like
public $default = array(
'driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'test.com',
'port' => '3306',
'login' => 'test',
'password' => 'test',
'database' => 'test',
'prefix' => ''
);
Can anybody help me to get through this.
Firstly, you should update to 2.0.6 (latest stable 2.0.x), or 2.2.2 which is the latest stable. You can find them here.
2.0.0-dev is unstable and outdated, you should use a stable version instead. I don't know why you'd want to run a production site with a -dev version, you're asking for problems.
Database configuration info can be found here.

Categories