I was using XAMP for windows but there were forming a lot of problems with MySql so uninstalled it and installed Apache Web Server. I connected Apache to PHP and it worked fine. I installed MySql again and it worked fine.
Now I can not get MySql to work with PHPMyAdmin. I did not test PHP to see if it worked with MySql without PHPMyAdmin.
My PHPMYADMIN config.inc file:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use setup/
*
* All directives are explained in Documentation.html and on phpMyAdmin
* wiki <http://wiki.phpmyadmin.net>.
*
* @version $Id: config.sample.inc.php 13111 2009-11-09 15:02:21Z lem9 $
* @package phpMyAdmin
*/
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = '***********'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
/* User for advanced features */
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Advanced phpMyAdmin features */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma_relation';
// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
// $cfg['Servers'][$i]['history'开发者_如何学Go] = 'pma_history';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';
/*
* End of servers configuration
*/
/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
The line that says $cfg['blowfish_secret'] = '***********'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
doesn't really say that, I just don't want to share it. It only contains letters by the way.
PHP PHP.INI file:
I was too big to put on here. To see it look at the link: http://ericlounge.host22.com/000/stack/php.ini
By the way: I am using Windows 7
Edit: Sorry for the lach of info. I was in a rush. I'm not anymore:
The error said: Cannot load mysql extension. Please check your PHP configuration. - Documentation
My PHPINFO PAGE does not say anything about MySql but I might have missed it. I put the source into a page. Just follow the link below: http://ericlounge.host22.com/000/stack/phpinfo.html
I did what pdjota said but I get the error:
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mysqltest.php on line 2
Create a .php file that only contains
<?php
phpinfo();
?>
access that from a browser and see if php is configured with mysql support.
Your output from phpinfo should have a MySQL section, here is an example one yours should have similar mysql info http://74.125.47.132/search?q=cache:Pto_DJIncV8J:www.entropy.ch/software/MacOSX/php/test.php+phpinfo&cd=6&hl=en&ct=clnk&gl=us&client=firefox-a
In Windows that means that PHP couldn't load the correct DLL.
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mysqltest.php on line 2
In your PHPInfo, the extension_dir is set C:\php5 It seems that the php_mysql.dll is missing in that directory. Look for it in your installation and copy to c:\php5 or change your extension directory.
For more info you ought to check the manual
Hi, it is difficult to tell without the actual error. In you php.ini the extension=php_mysql.dll is set, so it may be ok. Check running as MindStalker said
phpinfo();
to see if the extension is loaded actually, and then check mysql connection
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}else
echo 'Connected successfully';
mysql_close($link);
精彩评论