I'm installing Apache, PHP and MySql on Windows 7 (I need to run Apache under current user instead of a service so I can't use wamp or similar). The thing is PHP does not get to load mysql extensions, using phpinfo() I can see mysqlnd, not mysql, mysqli or pdo_mysql.

I remember having trouble with this in previous installations and having to download these DLL's from somewhere, so maybe it's happening again, are the mysql dll's coming with PHP version incorrect? What else can I do to properly install mysql extensions?

  • How did you install PHP? Did you remember to select the mysql* extensions in the installer? If not - no problem, just run the installer again and add them in. Also, make sure that the extensions directory is in the %PATH% environment variable.
    – DaveRandom
    Commented Jan 3, 2012 at 12:45
  • WAMP says Apache service can only run under LocalSystem user. I unzipped PHP and mysql dll's come with it, extension dir is in path, I restarted PC and php.ini points (I think) to right dir
    – user761076
    Commented Jan 3, 2012 at 12:49
  • If the bundle is so dumb, you can always ignore its GUI and find "Services" in Windows control panel. Commented Jan 3, 2012 at 12:51
  • WAMPP and XAMPP running great unter Windows7 perhaps you should install the programm as "Administrator" there are some problems with the "User Account Control". But when WAMPP is not running try XAMPP its cool and had a lot of functions and in the last XAMPP Version is PHP 5.3.8. Commented Jan 3, 2012 at 12:51
  • @user761076 Well they are wrong about the user, you can run it as anything you want... and please don't use WAMP, XAMPP, or any other lazy bundle for this, get the separate installers and do it properly. It will give you some headaches in the short term but it will help you learn how all these applications actually work, and it will save you a lot of headaches in the long run.
    – DaveRandom
    Commented Jan 3, 2012 at 12:52

2 Answers 2


You can use XAMPP using your current user credentials if not using it as a service (see here).
Otherwise check if the mysql extension is activated correctly in your php.ini and the .dll/.so is present in the extension folder.


Installing the MySQL extensions with the official PHP installer is pretty straightforward:

  • Run the wizard and click "Next" to get the install options
  • Click "Change"
  • Leave previous options and click "Next" until you get to "Choose Items to Install"
  • Under "Extensions", select the desired items (you don't need them all, just the ones you plan to use):
    • MySQL
    • MySQLi
    • PDO/MySQL
  • Click "Next" and "Change" to complete the installation.
  • Restart Apache.

If you happen to get further errors, it's possible that you need the MySQL client libraries (I admit I haven't installed PHP in a bare computer for a long while so I don't know if libmysql.dll is required by PHP). That can be obtained from any MySQL tool that bundles the appropriate DLL, such as HeidiSQL or MySQL Server itself.

An important thing to take into account when working with Windows 7 is that you need administration privileges to edit any file under "Program Files". Grant your editor those privileges when you run it or move custom data (such as your web sites) somewhere else.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.