mysql.ini is missing

Hello,

I'm trying to set up a Wordpress install and am getting "Your PHP installation appears to be missing the MySQL extension which is required by WordPress."

So far as I can tell, php5-mysql is installed. I installed with apt-get and dpkg -l show it as installed.

If I understand it correctly phpinfo() should show the file under "Additional .ini files parsed"

It's not there:

/etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini, /etc/php5/apache2/conf.d/suhosin.ini, /etc/php5/apache2/conf.d/xcache.ini

The file is in fact not in this directory, /etc/php5/apache2/conf.d/ and locate mysql.ini only turns up /etc/php5/conf.d/pdo_mysql.ini.

I decided to see if anyone had suggestions before I went any further.

I'm considering uninstalling and reinstalling php but I would rather not as it seems like that could cause more problems.

Could just create a new mysql.ini file?

Thanks for any suggestions.

9 Replies

Have you restarted Apache lately? service apache2 restart

Thanks for the reply, yes I restarted apache (several times)

I'm guessing that this is Ubuntu you are talking about…

php5-mysql does contain /etc/php5/conf.d/mysql.ini, I assume that is what you are looking for?

http://packages.ubuntu.com/precise/i386 … l/filelist">http://packages.ubuntu.com/precise/i386/php5-mysql/filelist

Yes, this is the file I'm looking for.

The "Additional .ini files parsed" section in phpinfo() are for additional php config files, not for mysql files. PHP has no reason to read from the MySQL config file.

However, what you should see in phpinfo are MySQL and MySQLi sections. The presence of these will tell you that MySQL extension for PHP is installed and enabled. Check in your php.ini for the lines:

extension=php_mysql.so
extension=php_mysqli.so

If there is a semi-colon in front of those, then the extensions are disabled. Remove the semi-colons, and restart your web server and you should have success.

These two lines:

extension=php_mysql.so

extension=php_mysqli.so

are not in php.ini, so I can't uncomment.

I did try manually adding them but it didn't help.

Makes me think the mysql extension is not enabled ( how would I enable it? ) or it's corrupted. As I mentioned in the first post it appears to be installed.

Try reinstalling the php mysql package apt-get purge php5-mysql; apt-get install php5-mysql then restart apache.

Thanks for the replies, reinstalling php5-mysql did the trick.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct