I'm encountering an error every time I'm connecting to my MS SQL 2005 database using CodeIgniter framework, I'm using PHP 5.6.8 version.`
"Fatal error: Call to undefined function sqlsrv_connect() in C:\xampp\htdocs\my_website\system\database\drivers\sqlsrv\sqlsrv_driver.php
on line 76"
I've already added dll files php_pdo_sqlsrv_56_ts.dll and php_sqlsrv_56_ts.dll to ext folder and on my php.ini, and installed Microsoft SQL Native Client 2012,
this is my code in the sqlsrv_driver.php line 76 -> return sqlsrv_connect($this->hostname, $connection);
I already setup and installed all needed files but still I encounter this error, and NO sqlsrv in phpinfo(), so I created a sample php file to test if I will connect to my database w/out using a framework and its successfully connected in MS SQL database, However it doesn't if I used codeigniter.
Did I miss some code, configuration or software to install? Thanks for usual support!
This is my database.php
$db['default']['hostname'] = 'MY-PC\MSSQL2005';
$db['default']['username'] = 'sa';
$db['default']['password'] = 'password';
$db['default']['database'] = 'MYDB';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
Related
The problem is am running this project in MAMP php version 8.0.3, and the codeIgniter version is 3, I think it will not support in php version 8.0.3. What is the solution of this problem?
This is my localhost url :http://localhost:8888/mansions/
$db['default']['hostname'] = 'localhost:8888';
$db['default']['username'] = 'root';
$db['default']['password'] = 'root';
$db['default']['database'] = 'mansions_new_live';
$db['default']['dbdriver'] = 'mysqli';
$db['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
This is the database configuration details. Is there any solution for this?
I want to run this project in mamp server, its already working in windows server. but it is not working in mamp php version 8.0.3
Your mysql driver is deprecated. To use mysqli driver, add this parameter to your config file located in config/database.php.
$db['default']['dbdriver'] = 'mysqli';
I was previously using Xampp 1.8.2 and CodeIgniter 2.2.1 connecting to MSSQL 2012. My database configuration was working well and fine until i moved to xampp 5.5.19 and using the same database configuration. This is how i did it:
I downloaded respective Microsoft drivers for PHP for SQL server (php_sqlsrv_5ts.dll) and copied it to the ext folder in the php installation folder. I then updated my php.ini file to load this extension. I also configured my MSSQL co listen to a specific port (is used the standard 1433). I then configured my database connection in the config codeigniter folder as follows:
$db['default']['hostname'] = 'CORE14\CORE12';
$db['default']['username'] = 'sa';
$db['default']['password'] = 'sa';
$db['default']['port'] = 1433;
$db['default']['database'] = 'HomoOpes';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
I restarted my server and tried to access my application. I get the error:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: C:\xampp\htdocs\TUMHRMS\system\database\DB_driver.php
Line Number: 124
I thought xampp 5.6 was unstable and i uninstalled it because it was bringing the same problem it then installed xamp 5.5.19 and am getting the same problem. Somebody help.
Thank you
try to use odbc driver
$db['mssql']['hostname'] = 'Driver={SQL Server};Server=CORE14\CORE12;Database=HomoOpes';
$db['mssql']['username'] = 'sa';
$db['mssql']['password'] = 'sa';
$db['mssql']['database'] = 'HomoOpes';
$db['mssql']['dbdriver'] = 'odbc';
try to change
$db['default']['dbdriver'] = 'sqlsrv';
to
$db['default']['dbdriver'] = 'mysql';
or
$db['default']['dbdriver'] = 'mysqli';
For our project we need to connect to an SQL server in PHP Codeigniter. Our server runs on an Linux webserver with Centos.
Normally we are common to use MYSQL to connect. For this project an SQL 2008 server already exist.
Is it possible to connect to an SQL 2008 server on such a Linux machine? And what do i need for that? Is it also possible to test the connecttion first in my Xampp dev in the local network?
I've had the greatest success with SQL Server connections running through ODBC drivers above anything else. Have you tried that yet?
http://technet.microsoft.com/en-us/library/hh568454.aspx
Try-> in your application/config/database.php put the following:
// This address is valid if you're on the same domain as the server:
// If not, you can put the ip address or url here as well.
$db['default']['hostname'] = 'DBComputerName\SQLEXPRESS';
// if you need a non default port uncomment and edit
//$db['default']['port'] = '5432';
$db['default']['username'] = 'databaseUsername';
$db['default']['password'] = 'databaseenter code herePassword';
$db['default']['database'] = 'DatabaseName';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
Error that is getting printed out
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 346
I have been looking through all the other questions and nothing seems to work. Still getting this error. All the info in my database.php file matched up to my info on the mysql server that I am running on the command line. I am also using mysqld and mysql.server start. I have tested the connection on the command line with
mysql -h localhost -uroot -p dbname
And that seems to work on my command line, but it is giving me the error above when I am referencing it on a localhost server I have set up with the codeigniter project. What am i doing wrong? I have double and triple checked naming conventions to make sure that it isn't the issue.
Also, I am on OS X Mavericks
my code in the config file is as follows:
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'PASS';
$db['default']['database'] = 'dbname';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
I have run into this problem frequently myself with CodeIgniter. The usual solution (for me!) is to set 'pconnect' and 'db_debug' to FALSE:
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;
I tried to change the following line in my config/database.php file and it worked. (The error your getting means something is wrong with your config/database.php)
'hostname' => '/Applications/MAMP/tmp/mysql/mysql.sock',
Explanation for this behaviour is written here (MySQL on OSX finds mysql.sock wrongly).
Cheers!
I develloping a web-based application with codeigniter and when I try to connect to my oracle entreprise 9g database the framework send me this error:
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed 'OCI_COMMIT_ON_SUCCESS'
Filename: database/DB.php
Line Number: 142
I tried different method to connect (classic, oracle specific).
There is my config/database.php file.
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=*xxx.xxx.xxx.xxx*)(PORT=1521))(CONNECT_DATA=(SID=*DB_NAME*)))';
$db['default']['username'] = '*username*';
$db['default']['password'] = '*password*';
$db['default']['database'] = '';
$db['default']['dbdriver'] = 'oci8';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
I think it's not a connection error, can you help me?
OCI_COMMIT_ON_SUCCESS is a constant declared in the Oracle PHP extension. Are you sure you have that installed correctly? Is it enabled in php.ini? Can you confirm that you can connect to the database manually with oci_connect?
If you don't have the extension, then you'll need to install it. There is a list of steps I generally take to debug the installation here.
I'm not sure what the value of OCI_COMMIT_ON_SUCCESS is, but you might be able to fake it with your own define, if it comes to that.