Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question
    
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 Jan 3 '12 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 Jan 3 '12 at 12:49
    
If the bundle is so dumb, you can always ignore its GUI and find "Services" in Windows control panel. –  Álvaro G. Vicario Jan 3 '12 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. –  Stony Jan 3 '12 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 Jan 3 '12 at 12:52
show 2 more comments

migrated from stackoverflow.com Jan 3 '12 at 12:51

This question came from our site for professional and enthusiast programmers.

2 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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