Your PHP installation appears to be missing the MySQL ... (25 posts)

  1. cmturner2
    Posted 11 years ago #

    This is a solution to the fairly common problem:

    Your PHP installation appears to be missing the MySQL which is required for WordPress.

    Provided of course you do have apache/php/mysql installed and mostly working already.

    If you do, one solution is to place this bit of code in wp-settings.php before the check for MySQL which will load the mysql module if it's available:

    if (!extension_loaded('mysql'))
    if (!dl('mysql.so')) {

    However, next time you upgrade WordPress you will need to remember to re-hack this code into wp-settings.php (unless it gets added to an official release someday).

    The better solution is to edit your php.ini (generally in /etc/php4/apache or similar under linux) and add the mysql module to the list of extensions at the very end of the file with:


    Restart Apache and you should be all set.

    I've tested this specifically on Debian Sarge with Apache 2.0.54, MySQl 4.0.24, and PHP 4.3.10-15

    I'm not taking credit for it, as Herman had most of the solution in this post ( http://comox.textdrive.com/pipermail/wp-hackers/2005-April/000821.html ), I'm just expanding on it. Hopefully this will make it onto the wiki and save folks some time in the future.

    Also, minor nitpick, but "...missing the MySQL which..." needs to be re-written. Either lose 'the' or add 'module' for a better sounding sentance.

  2. mseabra
    Posted 11 years ago #

    Finally got it. Just go to your php.ini file and uncomment the ";" from the following lines (that means DELETE the ";"). You should have 3 lines without the ";" as follows:
    ;Windows Extensions
    ;Note that ODBC support is built in, so no dll is needed for it.
    After that, save the php.ini file and you should be good to go.

    Marco Seabra

    [Moderated - needless URL removed]

  3. llbbl
    Posted 10 years ago #

    This suggestion to try uncommenting the *.dll's does not seem to work if you are running windows 2003, mysql 4.0.12, PHP 5.05. I have tried this and the several other suggestions trying to get PHP to recognize the Mysql on my machine. I will let you know when I figure it out.

  4. llbbl
    Posted 10 years ago #

    Here is how I solved it.

    1) Uncommented the line


    in the php.ini file. Save the file.

    2) Download the PHP Binaries .zip package with all the *.dll's in it.

    3) Copy libmysql.dll and ext/php_mysql.dll over to the folder where the php-cgi.exe file resides.

    This is assuming you have used the PHP 5.0.5 installer that says it is CGI only. That installer will register .php file extention for IIS 6.0 and do all that other junk that you would have to do manually. This is assuming your MySQL is installed and you can access it via MySQL Administrator.

  5. larry_Luckham
    Posted 10 years ago #

    I tried each of the above, in turn, and none worked on my win2003, IIS6 server. Each caused a different result, but none worked. Both PHP & MySQL seem to be running, i.e IE will correctly execute a simple PHP sequence and MySQL is accessable throung the MySQL admin. Any other idea?

  6. acidflash
    Posted 10 years ago #

    Sorry for my bad spelling
    Sorry for taking an old post up to new.
    But I have a strange problem.
    I have moved my hole wordpress to a new server, and that runs Fedora2 (I have a VPS), and when I transfer my database from the old one to the new one all my åäö was wrong, so I updated my MySQL server from v3 to v4, and all that was working out. When I upgraded MySQL i get a strange problem.
    "Your PHP installation appears to be missing the MySQL which is required for WordPress."
    I don’t know what that problems is, I have installed PHP4 and MySQL version 4.1.16.
    I have put in extension=mysql.so in my php.ini file. But that doesn’t work.
    Do any have the solution on that?

  7. chebolsk
    Posted 10 years ago #

    Here's what I did to fix this problem on my machine (Win XP, Apache 2, PHP5, MySQL 5)

    edit php.ini

    1. remove ";" from ";extension=php_mysql.dll"
    so it becomes:

    2. change extension_dir = "./" to point to the location of the php_mysql.dll file. In my case it was c:\php\ext

    so it becomes:
    extension_dir = "c:\php\ext"


  8. riccardog
    Posted 10 years ago #

    Dear friends,
    my configuration is:
    - Windows XP SP2
    - Apache 2.0.55
    - PHP 5.1.2
    - MySQL 5.0.12
    - WordPress 2.0.1

    I tried each of the above solutions, but it still give me:
    "Your PHP installation appears to be missing the MySQL which is required for WordPress."

    Any more suggestions???

    Many thanks,

  9. riccardog
    Posted 10 years ago #

    I found out the solution:
    avoid using PHP 5 and use PHP 4.

    Because PHP 5 doesn't enable MySQL on default...

    Riccardo Gianninoni

  10. michaelberg
    Posted 10 years ago #

    chebolsk got it right but there is one key information missing: You *must* modify the system path so that the path to your php installation is included! (actually this piece of info is listed on the php installation page somewhere but they fail to stress just how important this is).

    You can modify the path in Windows by right clicking My Computer, and under the Advanced tab modify the Path environment variable. Just append the php installation directory. Reboot the pc (yes I'm serious). After that you should have no problems.

    WordPress famous 5-minute install .. OH YEAH. Just remember the 2 hour install of Apache and php that is a prerequisite. I love computers.

  11. sainib
    Posted 10 years ago #

    Guys the issue is that the Apache is not able to read the php.ini file, Do this and your problem will be solved.

    Note : I copied the file at (following) three locations but you can try one at a time to see which is the correct place.

    Copy the php.ini file from C:\Program Files\Apache2\Apache Group and paste it in
    - C:\Windows\
    - C:\Windows\System32\
    - C:\Program Files\Apache Group\Apache2\bin

    The file php.ini was already present in C:\Windows which was surely not done by me, so system internally placed it there.. and I am suspecting that should be the correct dir.

    I think there is a logic in Apache to see if the ini file is already placed in C:\Windows, if not pick from Apache Group and copy it in c:\windows ..
    so if you start the server before completing the changes to ini file.. it will place the ini file in windows dir and will not attempt to copy again after subsequent changes

    In anycase, following above steps should resolve the problem

  12. Laren
    Posted 10 years ago #

    What about with a Mac? And I've never run across anything about 'Apache' before now. What is it? What does it do in relation to this install? (It isn't mentioned in the directions.)

    Please help.


  13. sainib
    Posted 10 years ago #

    I believe Mac already has a webserver by default.. dont think it is APache though..However you can install the Apache Linux version.
    And yes.. its a webserver, a server that your browser connects to when you type the internet address..Hope it helps.

  14. hughbiquitous
    Posted 10 years ago #

    Here's a tip so you can install on Windows without rebooting:

    1. Create a plain-vanilla user account (ie. no admin rights or anything), for example, "apache".

    2. Go to Administrative Tools->Local Security Policy. Go into "Local Policies\User Rights Assignment" and double-click the item called "Log on as a service." Add the user account you created in #1 to this list.

    3. Grant this account "Modify" access to your "C:\Program Files\Apache Group" directory (it should flow through to all the descendant folders).

    4. (Possibly) If you've moved your DocumentRoot out of your "C:\Program Files\Apache Group" directory, you'll need to repeat step 3 for those folders.

    5. Go to Administrative Tools->Services. Stop the Apache2 service. Double-click "Apache2" to bring up its properties and go to the "Log On" tab. Make it run in the account you created in #1, and restart the service.

    That should do it...

    If you're interested, the reason a reboot is normally required is that by default, Apache runs in the System account. The System account only reads the environment variables (including PATH) at boot time. By making Apache run in its own user context, it gets the environment variables fresh every time it starts.

    It's a good idea to avoid using the System account for anything, really... that account pretty much holds the keys to the kingdom...

  15. pchristmann
    Posted 10 years ago #

    The answer, for me, was indeed found in these comments. I'm using PHP 5.1.4 on Windows XP under Apache 2.0.55.

    I added PHP to my path and rebooted. I uncommented out the extension=php_mysql.dll entry and changed the extension_dir. Based on sainib's comments, I started digging through PHP documentation and finally found this link to describe where to put the php.ini file:


    So, when I added the described PHPIniDir directive, everything worked. Whew...

  16. Everybody trying to setup their own systems like this needs to ignore "riccardog"'s comments above. PHP5 is MUCH nicer than PHP4, and all you really have to do to enable the mysql support is edit the PHP.INI file and uncomment that line.

    As for where you place the file, leave it in the PHP directory. Then in Apache's httpd.conf file, you put:
    PHPIniDir C:/path/to/your/php/directory

    Simple. That's where it will check for the INI file first. Since you have to edit the httpd.conf file anyway (to enable the PHP support), it's no big deal.

    It only takes about 15 minutes to install PHP5 and Apache on your server box, and editing the config files is really not all that complex. Though you may need to come back and edit them again later when you find that some particular plugin doesn't work because you need enable something else.

    The benefit of the DIY approach here is that you have complete control. But then, the downside is that you have complete control. :)

  17. mikee_mikee
    Posted 10 years ago #

    If you have a debian system, it's as easy as:
    apt-get install php5-mysql

    Restart apache, and that is it!!

  18. muskie
    Posted 10 years ago #

    I am getting this error message on OS X 10.4.7 trying to install WordPress 2.0.3. I've got the default version of Apache 1.3.33 but with PHP 5.1.4 and MySQL 4.1.20.

    I started up another thread as this is so Windows specific and I have an odd combination of versions.


  19. starkruzr
    Posted 10 years ago #

    I just want to note that for most applications you're not going to notice a difference between PHP4 and PHP5 EXCEPT when PHP5 breaks things. For example, last I checked phpBB did not support PHP5, and I am fairly certain there are other major applications which don't support it either.

  20. deantmenzel
    Posted 10 years ago #

    Thank you all for your helpful diagnostic advice above. I used a combination of posts to solve the problem so here is a brief recount of what I did.

    I have installations of
    - PHP 5.1.4 (using the Windows Binaries PHP 5.1.4 installer)
    - MySQL 5.0.22
    - Microsoft IIS 5.1
    all running on Windows XP locally.

    Do the following steps:
    1. See reply from "llbbl" (posted on 2005-09-27 22:25:00) and do steps 1, 2 and 3 (the explanatory paragraph at the end is useful also)
    2. See post from "chebolsk" (posted on 2006-02-24 03:11:06) and do step 2.

    That's all that is required for this particular configuration.

  21. dwille
    Posted 9 years ago #

    I found the following to be useful when configuring WordPress to work with Windows XP, IIS 5.0 and PHP 5.1.6. I assume that IIS already serves up PHP pages and you're getting the "Your PHP installation appears to be missing the MySQL which is required for WordPress" error.

    1. Go to http://dev.mysql.com/downloads/ and select "MySQL Connector/PHP"

    2. Download both the mysqli and mysql extensions.

    3. Move the files that begin with "php_" to your extensions directory (usually c:\php\ext). Overwrite the existing files since these are NEWER and the LATEST from MySQL.

    4. Move libmysql.dll to your PHP directory (C:\php). Overwrite the existing file (the one you've downloaded is NEWER). Both ZIP files will have the same libmysql.dll since after PHP 5.0.2 both the mysql and mysqli extensions use the same file.

    5. Edit your php.ini file (in C:\php). Ensure the following lines exist and are NOT commented out:


    6. Ensure your extensions directory is set as well in the php.ini file:

    extension_dir = "C:\php\ext"

    7. Configure Windows so it can find PHP, its DLLS, and the php.ini file (this was the CRITICAL step for me, especially the PHPRC variable I describe):

    Click Start -> Control Panel
    Double-click System
    Select the "Advanced" tab
    Click the "Environment Variables" button
    Under the "System variables" section, click the "Path" variable
    Click the "Edit" button
    Add "C:\php" to the path (no quotes). Note that each path is separated by a semicolon. Also, you should preferably add this EARLY in the path, since some of the MySQL DLLs may be included in other locations on your computer, and you'd like PHP to find the one installed in C:\php before it finds any other.
    Click "OK"
    Now, click the "New" button (again, in the "System variables" section)
    For variable name, supply "PHPRC"
    For variable value, supply "C:\php"
    Click "OK" repeatedly until you've got all the windows closed.

    8. Restart the computer so that these settings will be loaded and recognized by PHP. You can verify that your correct php.ini file is being loaded by testing a simple PHP page with the following:




    If your settings are correct, you should see that "Configuration File (php.ini) Path" is "C:\php\php.ini" on the resulting page.

  22. andhapp
    Posted 9 years ago #

    Hello all,

    I had the same problem and it took me ages to identify the root cause of this issue. Here's the solution on my blog:

    PS: Check under PHP or WordPress section

  23. dmaher
    Posted 9 years ago #

    All I had to do was install the PHP-MySQL+++++++.rpm file on the server and all was fine. I didn't have to do any of the other stuff, it just worked after that.

  24. monaonsy
    Posted 9 years ago #

    I don't know if any of you is still facing that problem, but what worked for me is copying libmysql.dll from MySQL Server 5.0\bin to c:\Windows

  25. handuma
    Posted 9 years ago #

    The command, apt-get install php4-mysql, will add the mysql module to php4 on Debian. Restart Apache. You should be good to go:)

Topic Closed

This topic has been closed to new replies.

About this Topic