2

I've already seen this post PHP doesn't see mysql extension, but it didn't help me.
I use:

  • Windows Seven (both 32bit in a VM and 64bit on a real pc)
  • Apache 2.2 with SSL
  • PHP 5.3.8
  • MySql 5.5.23

In httpd.conf I configured Apache with PHP

PHPIniDir "C:\WEB\PHP\"
LoadModule php5_module "C:\WEB\PHP\php5apache2_2.dll"
ScriptAlias /php "C:/WEB/PHP/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe"

In php.ini I set

extension_dir = "C:/WEB/PHP/ext/"
[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll

MySql is started and working, but PHP does not see mysql.
I've also tried to copy libmysql.dll into %windir%\system32 and restarted web server, but it didn't work.
If you need I can post other info.

UPDATE 1:
Running <?php phpinfo(); ?> I can only see mysqlnd, but not mysql nor mysqli.
If I run php -i I see

mysql

MySQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Client API version => mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $

UPDATE 2:
Apache, PHP and MySQL folders are the same of a previous working pc.
I copied them, reconfigured paths, installed and started services:

httpd -k install && httpd -k start
mysqld --install && net start mysql

UPDATE 3:

  • I'm able to use mysql through a DOS console
  • If I try to run an existing PhpMyAdmin I get The mysql extension is missing. Please check your PHP configuration.

UPDATE 4:
I checked with Everything and the only php.ini I have on my pc is the one in php folder.

UPDATE 5:
I tried this code:

<?php
ini_set('display_errors', 'on');
error_reporting(E_ALL);
mysql_connect();
?>

and I get Fatal error: Call to undefined function mysql_connect() in C:\var\www\Apache\test.php on line 4

15
  • What does phpinfo() say? Commented Apr 27, 2012 at 21:04
  • As Starx said, you should phpinfo() out your config. Also, how do you know that php isn't seeing mysql? What errors are you seeing? Commented Apr 27, 2012 at 21:05
  • Yes it is the problem with paths, then, check if the extensions are present in C:/web/php/ext/ directory Commented Apr 27, 2012 at 21:11
  • Can you connect to the mysql through DOS? Commented Apr 27, 2012 at 21:18
  • Are there any PHP errors when you attempt to communicate with mysql? Commented Apr 27, 2012 at 21:18

3 Answers 3

3

I've fixed the same problem adding to the Environment Variable "Path" of Windows (System > Advanced > Environment Variables > Path) the following paths:

c:\Program Files\PHP5;C:\Program Files\MySQL\MySQL Server 5.5\lib

The first one is where php.ini is located, the second one (most important!) is where libmysql.dll is located (usually inside the "lib" directory inside the mysql installation dir)

This operations are quite well described in the PHP.net page http://php.net/manual/en/mysqli.installation.php

Now it works.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, this usually helps. Remember that adding/changing an environemt variable need a pc restart to take effect :)
1

You need to move the extension=php_mysql.dll and extension=php_mysqli.dll lines in your php.ini file up. They should be with all the generic settings.

As far as I know, there is no section for php_mysql and php_mysqli, it's just mysql and mysqli, but those only contains specific settings for those modules. The actual extensions are loaded before those settings are read.

2 Comments

php.ini has lots of other lines and is the same I used on a previous working pc...
I would give this a shot, just to remove placement within php.ini as a distractor.
0

The most feasible and time saving option I see now, is to do the fresh installation of WAMP itself, and migrate the old files and dbs to the new one.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.