i had uploaded my website to server and then i tried to access, but the code igniter returns me that error that i don\'t find any answer, why is this happening?
my c
I had the same issue, in my case the site was up an running fine for a long time. Since lots of answers here concern a first time install and use I decided to tackle the same issue for systems that already function properly for a while then suddenly give this error.
First I think is important to understand the issue. As far as I know (and I may be wrong) this issue comes up if the driver cannot secure a connection to the database. This can be caused by many things, including the database being down for any issue or maintenance.
In my case the issue was caused as I accessed the website during a MySQL update (Software Updater was running in the background updating MySQL components). So I had to wait for the update to complete, then the website was again up and running with no issues.
So keep this aspect in mind, too.
MySQL connection driver does not get any meaningful server at the location of localhost. So use,
'hostname' => '127.0.0.1'
rather than
'hostname' => 'localhost'
I've got this error
mysqli::real_connect(): (HY000/2002): No such file or directory
from PhpMyAdmin running on my Mac Mojave, with MySQL server also running on my Mac.
Fixed it by editing PhpMyAdmin/config.inc.php
and changed the line:
$cfg['Servers'][$i]['host'] = 'localhost';
to
$cfg['Servers'][$i]['host'] = '127.0.0.1';
Same problem occurd with me, with AWS RDS MySQL. Looked various sources, but as of this thread, almost all lack of answer. While this answer helped me, tweak in mind to update hostnames at server. Access your SSH and follow the steps:
cd /etc/
sudo nano hosts
Now, Appending here your hostnames: For example:
127.0.0.1 localhost
127.0.0.1 subdomain.domain.com [if cname redirected to endpoints]
127.0.0.1 xxxxxxxx.xxxx.xxxxx.rds.amazonaws.com [Endpoints]
and now, configuring config/database.php
as follows:
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => '35.150.12.345',
'username' => 'user-name-here',
'password' => 'password-here',
'database' => 'database-name-here',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
where 35.150.12.345
is your IPv4 Public IP, located at ec2-dashboard > Network Interfaces > Description : RDSNetworkInterface >> IPv4 Public
IP('35.150.12.345') there.
Note: Please note that only IPV4 will work at 'hostname' option. hostname, cname, domains will output database connection error.
I had this same problem. I was using a host defined in my /etc/hosts file:
127.0.0.1 test.localhost
and connecting with the url http://test.localhost/index.php/news/view as in the tutorial. I got that error, and only fixed it by changing the line:
'hostname' => 'localhost',
to:
'hostname' => 'test.localhost',
I suggest you enable and look at the detailed php_errors.log
Check that the directory specified using session.save_path in php.ini exists and is writable. You can use phpinfo() to show the actual session.save_path.
Creating the missing "phptmp" directory specified as session.save_path fixed this issue for me.