CodeIgniter Forums
Please help in the correct PHP configuration - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Please help in the correct PHP configuration (/showthread.php?tid=64480)



Please help in the correct PHP configuration - moshair - 02-23-2016

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
);



RE: Please help in the correct PHP configuration - skunkbad - 02-23-2016

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

Have you tried just using "localhost" for the hostname?


RE: Please help in the correct PHP configuration - moshair - 02-23-2016

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


RE: Please help in the correct PHP configuration - skunkbad - 02-23-2016

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.


RE: Please help in the correct PHP configuration - moshair - 02-23-2016

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


RE: Please help in the correct PHP configuration - InsiteFX - 02-23-2016

Try checking mysql and mysqli in the check boxes


RE: Please help in the correct PHP configuration - moshair - 02-24-2016

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")



RE: Please help in the correct PHP configuration - moshair - 02-24-2016

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



RE: Please help in the correct PHP configuration - InsiteFX - 02-24-2016

Thats saying that your host provider has different mysqli versions running.


RE: Please help in the correct PHP configuration - moshair - 02-24-2016

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,