Page 1 of 1
Trouble configuring PHP for use with MySQL
Posted: Sun May 09, 2010 10:01 pm
by Bacu
After enabling MySQL in the .ini, it still doesn't work. Any page that I try to use MySQL in won't yield anything but a blank screen, but no outright errors. phpinfo doesn't say that MySQL module is enabled. Any suggestions?
Re: Trouble configuring PHP for use with MySQL
Posted: Mon May 10, 2010 8:38 am
by mikosiko
show/tell us:
- few lines around the line where did you enabled MySql
- your platform... windows/Linux?
- some of the code that you are using for testing
in your php.ini what is the value of the variable "extension_dir" ?
are you sure that in the folder indicated in extension_dir you have the php_mysql.dll or php_mysqli.dll ?
Re: Trouble configuring PHP for use with MySQL
Posted: Mon May 10, 2010 9:22 pm
by Bacu
Code: Select all
<?php
$mysqli = new mysqli("localhost", "root", "pass", "DB");
if (mysqli_connect_errno()){
printf("connection failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("host information %s\n", mysqli_get_host_info($mysqli));
mysqli_close($mysqli)}
?>
Just a simple chunk to test connection or not, before I start trying to figure it out.
on windows.
There is no php_mysql.dll or php_mysqli.dll, I'm guessing that's part of the problem.
Re: Trouble configuring PHP for use with MySQL
Posted: Tue May 11, 2010 6:49 am
by mikosiko
Bacu wrote:There is no php_mysql.dll or php_mysqli.dll, I'm guessing that's part of the problem.
for sure it is the problem.
- your extension_dir must point to the "ext" folder under your PHP directory installation
- php_mysql.dll or php_mysqli.dll (ideally both but only 1 is required.. looking your code you need the second one) must be present under the "ext" directory.
set it up and be sure to re-start Apache and check again with phpinfo()
Re: Trouble configuring PHP for use with MySQL
Posted: Fri May 14, 2010 9:50 pm
by Bacu
php_mysqli.dll is in /ext
changed extension_dir to C:\php\ext
Still nothing.