Welcome Guest, Not a member yet? Register   Sign In
Please help in the correct PHP configuration
#1

(This post was last modified: 02-23-2016, 02:24 PM by moshair.)

Hello,

Sometimes I see this error for few minutes:

Code:
A PHP Error was encountered

Severity: Warning

Message: mysqli::real_connect(): (HY000/2002): Connection refused

Filename: mysqli/mysqli_driver.php

Line Number: 202
A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: controllers/Log.php

Line Number: 6

There is PHP version select in the c-panel, What version should I use? and what recommended extensions to run CI 3.0.4

Please click on this image and tell me the correct values:

   

This is the database.php info:
Code:
$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
'dsn' => '',
'hostname' => 'sql.byethost32.org',
'username' => '[removed]',
'password' => '[removed]',
'database' => '[removed]',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
Reply
#2

It sounds like your username and/or password and/or database name is wrong.

Have you tried just using "localhost" for the hostname?
Reply
#3

Everything is correct and my website is working now, if they are incorrect it will not connect all the time. The problem happend when the hosting added PHP 7 to the PHP list and they made PHP 5.3 is the native and default, I changed it to PHP 5.6 I feel something is incorrect in php extensions now I selected nd_mysqli not mysqli
Reply
#4

If it works it works. You might try using a custom error handler to log PHP errors (unless you already have a PHP error log that you can access). If you feel that something isn't right, the error log will tell you.
Reply
#5

No the server don't store error_log file. Error log in C-panel shows not-found files.

I need someone can check the php settings is correct or not from this snapshot:

http://forum.codeigniter.com/attachment.php?aid=532
Reply
#6

Try checking mysql and mysqli in the check boxes
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

(This post was last modified: 02-24-2016, 12:57 AM by moshair.)

Now it is not working again.

I wrote a php file with
Code:
$con = mysqli_connect("sql.byethost32.org","[removed]","[removed]","[removed]");
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

I got this error:
Code:
Warning: mysqli_connect(): (HY000/2002): Connection refused in  on line 2
Failed to connect to MySQL: Connection refused

@InsiteFX I did as you said and removed nd_mysqli because of conflicting with mysqli. I got
Code:
Warning: mysqli_connect(): Headers and client library minor version mismatch. Headers:50626 Library:100020 in ...

Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL server on 'sql.byethost32.org' (111 "Connection refused") in ...
Failed to connect to MySQL: Can't connect to MySQL server on 'sql.byethost32.org' (111 "Connection refused")
Reply
#8

(This post was last modified: 02-24-2016, 12:58 AM by moshair.)

Now it is working again with last settings (mysqli), but I still see this warning on the test page:
Code:
Warning: mysqli_connect(): Headers and client library minor version mismatch. Headers:50626 Library:100020
Reply
#9

Thats saying that your host provider has different mysqli versions running.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#10

Thanks,

Now it is working and without that warning.

I thing it is related to the hosting, I will contact their support if it happens again.

Regards,
Reply




Theme © iAndrew 2016 - Forum software by © MyBB