WordPress.org

Support

Support » How-To and Troubleshooting » Your PHP installation appears to be missing the MySQL …

Your PHP installation appears to be missing the MySQL …

  • 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')) {
    exit;
    }
    }

    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:

    extension=mysql.so

    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.

Viewing 15 replies - 1 through 15 (of 24 total)
  • 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.
    extension=php_mssql.dll
    extension=php_msql.dll
    extension=php_mysql.dll
    ================
    After that, save the php.ini file and you should be good to go.

    Marco Seabra

    [Moderated – needless URL removed]

    llbbl
    Member

    @llbbl

    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.

    llbbl
    Member

    @llbbl

    Here is how I solved it.

    1) Uncommented the line

    extension=php_mysql.dll

    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.

    larry_Luckham
    Member

    @larry_luckham

    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?

    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?

    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:
    extension=php_mysql.dll

    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”

    HTH

    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,
    Riccardo

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

    Because PHP 5 doesn’t enable MySQL on default…
    http://it2.php.net/manual/it/faq.databases.php#faq.databases.mysql.php5

    Bye,
    Riccardo Gianninoni

    michaelberg
    Member

    @michaelberg

    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.

    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

    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.

    Thanks.

    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.

    hughbiquitous
    Member

    @hughbiquitous

    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…

    pchristmann
    Member

    @pchristmann

    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:

    http://www.php.net/manual/en/configuration.php#configuration.file

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

    Samuel Wood (Otto)
    WordPress.org Tech Dude

    @otto42

    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. 🙂

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Your PHP installation appears to be missing the MySQL …’ is closed to new replies.