I have an existing web app but for no apparent reason one section of the app is now displaying the following error:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 338
The rest of the app works fine and can connect using the same database credentials at application/config/database.php
Any help to point me in the right direction in terms of debugging the issue would be welcome.
This is for an existing Linux server, running MySQL 5, PHP 7 and Apache 2.
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 338
Related
I just made a script in codeigniter which fetches emails and displays them with php imap.
It fetches 500 mails at once no problem.
If i try to fetch about 2000 mails at once, it throws an error.
A Database Error Occurred
Error Number: 2013
Lost connection to MySQL server during query
SELECT GET_LOCK('77dfd862ae2b7bedaec521bc4c3651952b56e6c9', 300) AS
ci_session_lock
Filename: libraries/Session/drivers/Session_database_driver.php
Line Number: 358
This project is live on hostgator. I am not sure if it has mysql workbench or not.
I have no idea where it comes from and why.
I have done nothing with mysql in codeigniter before.
I do not know which file to edit and where to start. Please help.
Currently I am doing a web based PHP project which is connected with SQL Server with sqlsrv method in php. The frame work is CI, and I use php_pdo_sqlsrv_56_ts.dll extension to connect the SQL Server like (extension=php_pdo_sqlsrv_56_ts.dll) in php.ini. It works in my local client without any issue.
But I needed to host the web site in my shared web server, the SQL Server is already connect with an IP address.
How can I do this?
I tried in below method, but it gives error:
method 01
I uploaded all the dll files in web server and I changed the extension_dir as
extension_dir=http://example.uk/myweb/sqlsrv_dll_files/
method 02
I uploaded all the dll files in web server and I set the extension path as
extension=http://example.uk/myweb/sqlsrv_dll/php_pdo_sqlsrv_56_ts.dll
But this gives below error:
Fatal error: Call to undefined function sqlsrv_connect() in C:\xampp_v5\htdocs\web_project\system\database\drivers\sqlsrv\sqlsrv_driver.php on line 144
A PHP Error was encountered
Severity: Error
Message: Call to undefined function sqlsrv_connect()
Filename: sqlsrv/sqlsrv_driver.php
Line Number: 144
Backtrace:
Please advice me to rectify this error.
Thanks in advance,
The website works fine for a while but in a few days returns this error :
A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (HY000/2002): Can't connect to local
MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
Filename: mysqli/mysqli_driver.php
Line Number: 202
Backtrace:
File: /var/www/html/application/controllers/Login.php Line: 8
Function: database
File: /var/www/html/index.php Line: 289 Function: require_once
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/CodeIgniter.php
Line Number: 500
Help will be appreciated
Thanks
Nipun
Three things possible. Your database has been shut down (or it has died). You have not setup database to use a unix socket when both client and server are on the same machine. Or socket is not readable and writable by web user.
The warning is being thrown by mysqli driver. I would recommend that you use PDO driver to connect to the Database.It's simpler and a bit universal (You don't need to change Database settings once you change the DB)
you need confirm the database config file:application/config/database.php ensure the confirm item is correct
Please check your mysql server connectivity
If you run the app using your pc name i.e.
sahil-pc/recruitement or http://85.215.963.104:81/recruitement
you need to define it in index.php of root.
please check the permission of your db socket if you are using linux you need to make it in read and write mod.
note: ip details are fake don't try it
I got this error while i was installing a Codeigniter application in my Cpanel. The strange thing is it is working very well in my localhost but not in my Cpanel.
And I updated all the required fields with apt credentials..
Error
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 346
I am trying to uplaod my web to a host, I've had some problems I managed to solve but no this one. It's related to the database, and it only happens sometimes.
In some cases I have to query the database or even for the user registration it works fine, but in other cases I got the error:
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 346
I debugged the error (thanks #Valeh Hajiyev: CodeIgniter: Unable to connect to your database server using the provided settings Error Message) and in every case the connection seemed to be fine.
I hope someone who has had this problem before could help me.
EDIT: Oh snap! I just found out that refreshing the page a couple of times makes it work. What??